Index: /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17244)
+++ /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17245)
@@ -484,5 +484,5 @@
 		else{
 			IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvxEnum,StressbalanceAnalysisEnum,finiteelement,1);
-			if(iomodel->meshtype==Mesh3DEnum){
+			if(iomodel->meshtype!=Mesh2DverticalEnum){
 				IoModelToConstraintsx(constraints,iomodel,StressbalanceSpcvyEnum,StressbalanceAnalysisEnum,finiteelement,2);
 			}
@@ -963,5 +963,5 @@
 
 	IssmDouble   vx,vy;
-	int          meshtype,dim,approximation;
+	int          meshtype,dim,approximation,dofpernode;
 	int*         doflist = NULL;
 
@@ -969,6 +969,7 @@
 	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");
 	}
@@ -976,5 +977,5 @@
 	/*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);
 
@@ -986,5 +987,5 @@
 	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: */
@@ -995,8 +996,8 @@
 		/*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;
 		}
 	}
