Index: /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16720)
+++ /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 16721)
@@ -217,9 +217,17 @@
 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*/
@@ -289,4 +297,4 @@
 	xDelete<IssmDouble>(phi);
 	xDelete<int>(doflist);
-	if(basalelement!=element) delete element;
-}/*}}}*/
+	if(meshtype!=Mesh2DhorizontalEnum) delete element;
+}/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Element.h	(revision 16721)
@@ -101,5 +101,6 @@
 		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;
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 16721)
@@ -3149,4 +3149,12 @@
 
 	/*Return new Tria*/
+	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;
 }
Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.h	(revision 16721)
@@ -114,4 +114,5 @@
 		void   ResetCoordinateSystem(void);
 		void   SmbGradients();
+	   Element* SpawnBasalElement(void);
 		IssmDouble  TMeltingPoint(IssmDouble pressure);
 		IssmDouble SurfaceArea(void);
Index: /issm/trunk-jpl/src/c/classes/Elements/Seg.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Seg.h	(revision 16721)
@@ -104,9 +104,10 @@
 		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");};
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 16721)
@@ -2720,4 +2720,18 @@
 	/*Return new Seg*/
 	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");
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Elements/Tria.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16720)
+++ /issm/trunk-jpl/src/c/classes/Elements/Tria.h	(revision 16721)
@@ -120,4 +120,5 @@
 		void        ResetCoordinateSystem(void);
 		void	      SmbGradients();
+	   Element*    SpawnBasalElement(void);
 		IssmDouble  TMeltingPoint(IssmDouble pressure);
 		int         VelocityInterpolation();
