Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18527)
+++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18528)
@@ -579,6 +579,7 @@
 	StrainRateyzEnum,
 	StrainRatezzEnum,
 	DivergenceEnum,
+	MaxDivergenceEnum,
 	GiaCrossSectionShapeEnum,
 	GiadWdtEnum,
 	GiaWEnum,
Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18527)
+++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18528)
@@ -570,6 +570,7 @@
 		case StrainRateyzEnum : return "StrainRateyz";
 		case StrainRatezzEnum : return "StrainRatezz";
 		case DivergenceEnum : return "Divergence";
+		case MaxDivergenceEnum : return "MaxDivergence";
 		case GiaCrossSectionShapeEnum : return "GiaCrossSectionShape";
 		case GiadWdtEnum : return "GiadWdt";
 		case GiaWEnum : return "GiaW";
Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18527)
+++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18528)
@@ -582,6 +582,7 @@
 	      else if (strcmp(name,"StrainRateyz")==0) return StrainRateyzEnum;
 	      else if (strcmp(name,"StrainRatezz")==0) return StrainRatezzEnum;
 	      else if (strcmp(name,"Divergence")==0) return DivergenceEnum;
+	      else if (strcmp(name,"MaxDivergence")==0) return MaxDivergenceEnum;
 	      else if (strcmp(name,"GiaCrossSectionShape")==0) return GiaCrossSectionShapeEnum;
 	      else if (strcmp(name,"GiadWdt")==0) return GiadWdtEnum;
 	      else if (strcmp(name,"GiaW")==0) return GiaWEnum;
@@ -627,11 +628,11 @@
 	      else if (strcmp(name,"MisfitObservation")==0) return MisfitObservationEnum;
 	      else if (strcmp(name,"MisfitObservationEnum")==0) return MisfitObservationEnumEnum;
 	      else if (strcmp(name,"MisfitTimeinterpolation")==0) return MisfitTimeinterpolationEnum;
-	      else if (strcmp(name,"MisfitWeights")==0) return MisfitWeightsEnum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"MisfitWeightsEnum")==0) return MisfitWeightsEnumEnum;
+	      if (strcmp(name,"MisfitWeights")==0) return MisfitWeightsEnum;
+	      else if (strcmp(name,"MisfitWeightsEnum")==0) return MisfitWeightsEnumEnum;
 	      else if (strcmp(name,"SurfaceObservation")==0) return SurfaceObservationEnum;
 	      else if (strcmp(name,"WeightsSurfaceObservation")==0) return WeightsSurfaceObservationEnum;
 	      else if (strcmp(name,"MinVel")==0) return MinVelEnum;
@@ -750,11 +751,11 @@
 	      else if (strcmp(name,"MaterialsYoungModulus")==0) return MaterialsYoungModulusEnum;
 	      else if (strcmp(name,"MaterialsTimeRelaxationStress")==0) return MaterialsTimeRelaxationStressEnum;
 	      else if (strcmp(name,"MaterialsTimeRelaxationDamage")==0) return MaterialsTimeRelaxationDamageEnum;
-	      else if (strcmp(name,"MaterialsRidgingExponent")==0) return MaterialsRidgingExponentEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"MaterialsCohesion")==0) return MaterialsCohesionEnum;
+	      if (strcmp(name,"MaterialsRidgingExponent")==0) return MaterialsRidgingExponentEnum;
+	      else if (strcmp(name,"MaterialsCohesion")==0) return MaterialsCohesionEnum;
 	      else if (strcmp(name,"MaterialsInternalFrictionCoef")==0) return MaterialsInternalFrictionCoefEnum;
 	      else if (strcmp(name,"MaterialsCompressionCoef")==0) return MaterialsCompressionCoefEnum;
 	      else if (strcmp(name,"MaterialsTractionCoef")==0) return MaterialsTractionCoefEnum;
Index: ../trunk-jpl/src/c/classes/FemModel.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18527)
+++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 18528)
@@ -488,6 +488,7 @@
 	switch (response_descriptor_enum){
 
 		case DivergenceEnum:               this->Divergencex(responses); break;
+		case MaxDivergenceEnum:            this->MaxDivergencex(responses); break;
 		case IceVolumeEnum:                this->IceVolumex(responses); break;
 		case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(responses); break;
 		case MinVelEnum:                   this->MinVelx(responses); break;
@@ -562,6 +563,7 @@
 
 				/*Scalar output*/
 				case DivergenceEnum:               this->Divergencex(&double_result);               break;
+				case MaxDivergenceEnum:            this->MaxDivergencex(&double_result);            break;
 				case IceVolumeEnum:                this->IceVolumex(&double_result);                break;
 				case IceVolumeAboveFloatationEnum: this->IceVolumeAboveFloatationx(&double_result); break;
 				case MinVelEnum:                   this->MinVelx(&double_result);                   break;
@@ -1124,6 +1126,25 @@
 	*pdiv=total_divergence;
 
 }/*}}}*/
+void FemModel::MaxDivergencex(IssmDouble* pdiv){/*{{{*/
+
+	IssmDouble local_divergence;
+	IssmDouble node_max_divergence;
+	IssmDouble max_divergence = -INFINITY;
+
+	for(int i=0;i<this->elements->Size();i++){
+		Element* element=xDynamicCast<Element*>(this->elements->GetObjectByOffset(i));
+		local_divergence=element->Divergence();
+		if(fabs(local_divergence)>max_divergence) max_divergence=fabs(local_divergence);
+	}
+	ISSM_MPI_Reduce(&max_divergence,&node_max_divergence,1,ISSM_MPI_DOUBLE,ISSM_MPI_MAX,0,IssmComm::GetComm() );
+	ISSM_MPI_Bcast(&node_max_divergence,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+	max_divergence=node_max_divergence;
+
+	/*Assign output pointers: */
+	*pdiv=max_divergence;
+
+}/*}}}*/
 void FemModel::GetInputLocalMinMaxOnNodesx(IssmDouble** pmin,IssmDouble** pmax,IssmDouble* ug){/*{{{*/
 
 	/*Get vector sizes for current configuration*/
Index: ../trunk-jpl/src/c/classes/FemModel.h
===================================================================
--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 18527)
+++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 18528)
@@ -75,6 +75,7 @@
 		void MinVzx(IssmDouble* presponse);
 		void TotalSmbx(IssmDouble* pSmb);
 		void Divergencex(IssmDouble* pdiv);
+		void MaxDivergencex(IssmDouble* pdiv);
 		void IceVolumex(IssmDouble* pV);
 		void IceVolumeAboveFloatationx(IssmDouble* pV);
 		void ElementResponsex(IssmDouble* presponse,int response_enum);
Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18527)
+++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18528)
@@ -562,6 +562,7 @@
 def StrainRateyzEnum(): return StringToEnum("StrainRateyz")[0]
 def StrainRatezzEnum(): return StringToEnum("StrainRatezz")[0]
 def DivergenceEnum(): return StringToEnum("Divergence")[0]
+def MaxDivergenceEnum(): return StringToEnum("MaxDivergence")[0]
 def GiaCrossSectionShapeEnum(): return StringToEnum("GiaCrossSectionShape")[0]
 def GiadWdtEnum(): return StringToEnum("GiadWdt")[0]
 def GiaWEnum(): return StringToEnum("GiaW")[0]
Index: ../trunk-jpl/src/m/enum/MaxDivergenceEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/MaxDivergenceEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/MaxDivergenceEnum.m	(revision 18528)
@@ -0,0 +1,11 @@
+function macro=MaxDivergenceEnum()
+%MAXDIVERGENCEENUM - Enum of MaxDivergence
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=MaxDivergenceEnum()
+
+macro=StringToEnum('MaxDivergence');
