Index: /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp
===================================================================
--- /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp	(revision 9011)
+++ /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp	(revision 9012)
@@ -21,5 +21,5 @@
 	int index;
 	double rheology_bbar;
-
+	Element* element=NULL;
 
 	/*retrieve element we are interested in: */
@@ -28,5 +28,5 @@
 	/*now, go through our elements, and retrieve the one with this id: index: */
 	for(i=0;i<elements->Size();i++){
-		Element* element=(Element*)elements->GetObjectByOffset(i);
+		element=(Element*)elements->GetObjectByOffset(i);
 		if (element->Id()==index){
 			found=1;
@@ -40,14 +40,13 @@
 	if(!sumfound)_error_("%s%i%s","could not find material with id",index," to compute RheologyBbar");
 
-
-	_error_("element->RheologyBbarx not implemented yet!");
-
 	/*Ok, we found the material, compute Bbar: */
 	if(my_rank==cpu_found){
-		//rheology_bbar=element->RheologyBbarx();
+		rheology_bbar=element->RheologyBbarx();
 	}
 
 	/*Broadcast and plug into response: */
+	MPI_Allreduce ( &cpu_found,&cpu_found,1,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
 	MPI_Bcast(&rheology_bbar,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD); 
+
 	*prheology_bbar=rheology_bbar;
 }
Index: /issm/trunk/src/c/objects/Elements/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Element.h	(revision 9011)
+++ /issm/trunk/src/c/objects/Elements/Element.h	(revision 9012)
@@ -94,4 +94,5 @@
 		virtual void   UpdateShelfFlags(double* new_shelf_nodes)=0;
 		virtual int    UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0;
+		virtual double RheologyBbarx(void)=0;
 
 		/*Implementation: */
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 9011)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 9012)
@@ -7032,4 +7032,32 @@
 	/*Affect value to the reduced matrix */
 	for(i=0;i<24;i++) *(Pe_reduced+i)=Pi[i]-Pright[i];
+}
+/*}}}*/
+/*FUNCTION Penta::RheologyBbarx{{{1*/
+double Penta::RheologyBbarx(void){
+
+	double Bbar;
+	Penta* base=NULL;
+	
+	/*We here compute the vertically averaged Bbar. To do so, we go to the 
+	 * base element under this one, and call this->InputDepthAverageAtBase:*/
+		
+	base=this;
+
+	if(!base->IsOnBed()){
+
+		for(;;){
+			base=base->verticalneighbors[0];
+			if(base->IsOnBed())break;
+		}
+	}
+
+	/*We have found the base under this. Call InputDepthAverageAtBase on it: */
+	base->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
+
+	/*Ok, base->matice now has the Bbar. Ask Bbar from this enum: */
+	Bbar=base->matice->GetBbar();
+
+	return Bbar;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 9011)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 9012)
@@ -142,4 +142,5 @@
 		double TimeAdapt();
 		int*   GetHorizontalNeighboorSids(void);
+		double RheologyBbarx(void);
 		/*}}}*/
 		/*Penta specific routines:{{{1*/
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9011)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9012)
@@ -4628,4 +4628,11 @@
 }
 /*}}}*/
+/*FUNCTION Tria::RheologyBbarx{{{1*/
+double Tria::RheologyBbarx(void){
+
+	return this->matice->GetBbar();
+
+}
+/*}}}*/
 /*FUNCTION Tria::RheologyBbarAbsGradient{{{1*/
 double Tria::RheologyBbarAbsGradient(bool process_units,int weight_index){
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 9011)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 9012)
@@ -146,4 +146,5 @@
 		double TimeAdapt();
 		int*   GetHorizontalNeighboorSids(void);
+		double RheologyBbarx(void);
 		/*}}}*/
 		/*Tria specific routines:{{{1*/
