Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 9009)
+++ /issm/trunk/src/c/Makefile.am	(revision 9010)
@@ -695,5 +695,7 @@
 					./modules/ThicknessAbsGradientx/ThicknessAbsGradientx.h\
 					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
-					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h
+					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
+					./modules/RheologyBbarx/RheologyBbarx.cpp\
+					./modules/RheologyBbarx/RheologyBbarx.h
 
 
@@ -1366,4 +1368,6 @@
 					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp\
 					./modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h\
+					./modules/RheologyBbarx/RheologyBbarx.cpp\
+					./modules/RheologyBbarx/RheologyBbarx.h\
 					./solutions/diagnostic_core.cpp\
 					./solutions/convergence.cpp\
Index: /issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp
===================================================================
--- /issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp	(revision 9009)
+++ /issm/trunk/src/c/modules/DakotaResponsesx/DakotaResponsesx.cpp	(revision 9010)
@@ -74,5 +74,5 @@
 			/*indexed response: plug index into parameters and call response module: */
 			parameters->SetParam(index,IndexEnum);
-			
+
 			//Responsex(responses_pointer,elements,nodes, vertices,loads,materials, parameters,root,process_units);
 			Responsex(&femmodel_response,elements,nodes, vertices,loads,materials, parameters,root,process_units,0);//0 is the index for weights
Index: /issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationx.cpp
===================================================================
--- /issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationx.cpp	(revision 9009)
+++ /issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationx.cpp	(revision 9010)
@@ -21,5 +21,5 @@
 	/*retrieve parameters: */
 	parameters->FindParam(&migration_style,GroundingLineMigrationEnum);
-	
+
 	/*call different migration modules, according to user wishes: */
 	if(migration_style==AgressiveMigrationEnum) AgressiveMigration(elements,nodes, vertices,loads,materials, parameters);
Index: /issm/trunk/src/c/modules/Responsex/Responsex.cpp
===================================================================
--- /issm/trunk/src/c/modules/Responsex/Responsex.cpp	(revision 9009)
+++ /issm/trunk/src/c/modules/Responsex/Responsex.cpp	(revision 9010)
@@ -41,4 +41,5 @@
 		case RheologyBbarAbsGradientEnum:RheologyBbarAbsGradientx( responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
 		case DragCoefficientAbsGradientEnum:DragCoefficientAbsGradientx(responses, elements,nodes, vertices, loads, materials, parameters,process_units,weight_index); break;
+		case RheologyBbarEnum:RheologyBbarx(responses, elements,nodes, vertices, loads, materials, parameters,process_units); break;
 		default: _error_(" response descriptor \"%s\" not supported yet!",response_descriptor); break;
 	}
Index: /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp
===================================================================
--- /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp	(revision 9010)
+++ /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.cpp	(revision 9010)
@@ -0,0 +1,53 @@
+/*!\file RheologyBbarx
+ * \brief: compute Bbar for a certain element
+ */
+
+#include "./RheologyBbarx.h"
+
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../toolkits/toolkits.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+void RheologyBbarx( double* prheology_bbar, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters,bool process_units){
+	
+
+	extern int my_rank;
+	int i;
+
+	int found=0;
+	int sumfound=0;
+	int cpu_found=-1;
+	int index;
+	double rheology_bbar;
+
+
+	/*retrieve element we are interested in: */
+	parameters->FindParam(&index,IndexEnum);
+
+	/*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);
+		if (element->Id()==index){
+			found=1;
+			cpu_found=my_rank;
+			break;
+		}
+	}
+
+	/*Broadcast whether we found the element: */
+	MPI_Allreduce ( &found,&sumfound,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
+	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();
+	}
+
+	/*Broadcast and plug into response: */
+	MPI_Bcast(&rheology_bbar,1,MPI_DOUBLE,cpu_found,MPI_COMM_WORLD); 
+	*prheology_bbar=rheology_bbar;
+}
Index: /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.h
===================================================================
--- /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.h	(revision 9010)
+++ /issm/trunk/src/c/modules/RheologyBbarx/RheologyBbarx.h	(revision 9010)
@@ -0,0 +1,15 @@
+/*!\file:  RheologyBbarx.h
+ * \brief header file for computing Bbar for one element
+ */ 
+
+#ifndef _RHEOLOGY_BBARX_H
+#define _RHEOLOGY_BBARX_H
+
+#include "../../Container/Container.h"
+#include "../../objects/objects.h"
+
+/* local prototypes: */
+void RheologyBbarx( double* prheology_bbar, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,bool process_units);
+
+#endif  /* _RHEOLOGY_BBARX_H */
+
Index: /issm/trunk/src/c/modules/modules.h
===================================================================
--- /issm/trunk/src/c/modules/modules.h	(revision 9009)
+++ /issm/trunk/src/c/modules/modules.h	(revision 9010)
@@ -92,4 +92,5 @@
 #include "./Reducevectorgtofx/Reducevectorgtofx.h"
 #include "./Responsex/Responsex.h"
+#include "./RheologyBbarx/RheologyBbarx.h"
 #include "./RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h"
 #include "./Scotchx/Scotchx.h"
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9009)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 9010)
@@ -4754,6 +4754,6 @@
 	if(!this->IsOnShelf() && elementonshelf==true)swap=1;
     this->inputs->AddInput(new BoolInput(ElementOnIceShelfEnum,elementonshelf));
-	    
-	/*If this element just  became ungrounded, set its basal melting rate at 50 m/yr:*/
+	
+    /*If this element just  became ungrounded, set its basal melting rate at 50 m/yr:*/
 	if(swap){
 		Input* basal_melting_rate_input     =inputs->GetInput(BasalMeltingRateEnum);     _assert_(basal_melting_rate_input);
@@ -4789,5 +4789,5 @@
 	rho_ice=matpar->GetRhoIce();
 	density=rho_ice/rho_water;
-
+	
 	/*go through vertices, and update inputs, considering them to be TriaVertex type: */
 	for(i=0;i<3;i++){
Index: /issm/trunk/src/c/solutions/steadystate_core.cpp
===================================================================
--- /issm/trunk/src/c/solutions/steadystate_core.cpp	(revision 9009)
+++ /issm/trunk/src/c/solutions/steadystate_core.cpp	(revision 9010)
@@ -20,4 +20,5 @@
 	int dim;
 	int solution_type;
+	int max_its;
 	bool control_analysis;
 	
@@ -26,4 +27,5 @@
 	femmodel->parameters->FindParam(&control_analysis,ControlAnalysisEnum);
 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&max_its,MaxNonlinearIterationsEnum);
 
 	/*intialize counters: */
@@ -41,4 +43,8 @@
 			_printf_(VerboseSolution(),"%s\n","   checking velocity, temperature and pressure convergence");
 			if(steadystateconvergence(femmodel)) break;
+		}
+		if(step>max_its){
+			_printf_(VerboseSolution(),"%s%i%s\n","   maximum number of iterations ",max_its," reached");
+			break;
 		}
 		
