Index: /issm/trunk/src/c/objects/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penta.cpp	(revision 436)
+++ /issm/trunk/src/c/objects/Penta.cpp	(revision 437)
@@ -1111,11 +1111,22 @@
 	Tria* tria=NULL;
 	
-	/*Bail out if this element does not touch the surface: */
-	if (onsurface){
+	/*Bail out if this element if:
+	 * -> Non collapsed and not on the surface
+	 * -> collapsed (2d model) and not on bed) */
+	if ((!collapse && !onsurface) || (collapse && !onbed)){
+		return;
+	}
+	else if (collapse){
+
+		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+		 * and compute Du*/
+		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
+		tria->Du(du_g,u_g,u_g_obs,inputs,analysis_type);
+		delete tria;
 		return;
 	}
 	else{
 		
-		tria=(Tria*)SpawnTria(3,4,5); //grids 0, 1 and 2 make the new tria.
+		tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
 		tria->Du(du_g,u_g,u_g_obs,inputs,analysis_type);
 		delete tria;
@@ -1170,12 +1181,22 @@
 	Tria* tria=NULL;
 	
-	/*Bail out if this element does not touch the surface: */
-	if (!onsurface){
+	/*Bail out if this element if:
+	 * -> Non collapsed and not on the surface
+	 * -> collapsed (2d model) and not on bed) */
+	if ((!collapse && !onsurface) || (collapse && !onbed)){
 		return 0;
 	}
+	else if (collapse){
+
+		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+		 * and compute Misfit*/
+		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
+		J=tria->Misfit( velocity,obs_velocity,inputs,analysis_type);
+		delete tria;
+		return J;
+	}
 	else{
 
-		/*use the Tria::CreateMisfit routine, on a Tria Element which is made of the 3 upper grids at the surface of the ice sheet. : */
-		tria=(Tria*)SpawnTria(3,4,5); 
+		tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
 		J=tria->Misfit( velocity,obs_velocity,inputs,analysis_type);
 		delete tria;
