Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 18644)
+++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 18645)
@@ -161,7 +161,8 @@
 	Input* epl_thick_input = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(epl_thick_input);
 	Input* sed_head_input  = basalelement->GetInput(SedimentHeadEnum);
 	Input* epl_head_input  = basalelement->GetInput(EplHeadEnum);
-	Input* residual_input  = basalelement->GetInput(SedimentHeadResidualEnum);
+	Input* thick_input     = basalelement->GetInput(ThicknessEnum);
+	Input* base_input      = basalelement->GetInput(BaseEnum);
 
 	IssmDouble epl_specificstoring   = EplSpecificStoring(basalelement);
 	IssmDouble epl_conductivity      = basalelement->GetMaterialParameter(HydrologydcEplConductivityEnum);
@@ -194,7 +195,7 @@
 						&Ke->values[0],1);
 			
 			/*Transfer EPL part*/
-			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,sed_head_input,epl_head_input,residual_input);
+			transfer=GetHydrologyKMatrixTransfer(basalelement,gauss,sed_head_input,epl_head_input,thick_input,base_input);
 			D_scalar=transfer*gauss->weight*Jdet*dt;
 			TripleMultiply(basis,numnodes,1,0,
 										 &D_scalar,1,1,0,
@@ -268,6 +269,8 @@
 	Input* epl_thick_input   = basalelement->GetInput(HydrologydcEplThicknessEnum); _assert_(epl_thick_input);
 	Input* sed_head_input    = basalelement->GetInput(SedimentHeadEnum);
 	Input* epl_head_input    = basalelement->GetInput(EplHeadEnum);
+	Input* thick_input       = basalelement->GetInput(ThicknessEnum);
+	Input* base_input        = basalelement->GetInput(BaseEnum);
 	Input* residual_input    = basalelement->GetInput(SedimentHeadResidualEnum);    _assert_(residual_input);
 	if(dt!= 0.){old_wh_input = basalelement->GetInput(EplHeadOldEnum);            _assert_(old_wh_input);}
 
@@ -287,7 +290,7 @@
 			epl_thick_input ->GetInputValue(&epl_thickness,gauss);
 			
 			/*Dealing with the epl part of the transfer term*/
-			transfer=GetHydrologyPVectorTransfer(basalelement,gauss,sed_head_input,epl_head_input,residual_input);
+			transfer=GetHydrologyPVectorTransfer(basalelement,gauss,sed_head_input,epl_head_input,thick_input,base_input);
 			scalar = Jdet*gauss->weight*((water_head*epl_specificstoring*epl_thickness)+(transfer*dt));
 			for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
 		}
@@ -389,13 +392,13 @@
 	return rho_freshwater*g*sediment_porosity*sediment_thickness*(water_compressibility+(sediment_compressibility/sediment_porosity));		 
 }/*}}}*/
 
-IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* residual_input){/*{{{*/
-	
+IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/
 
 	int transfermethod;
-	IssmDouble epl_thickness,sed_residual;
+	IssmDouble hmax;
 	IssmDouble epl_head,sediment_head;
 	IssmDouble leakage,transfer;
+	HydrologyDCInefficientAnalysis* inefanalysis = NULL;
 
 	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
 
@@ -408,15 +411,17 @@
 	case 1:
 		_assert_(sed_head_input);
 		_assert_(epl_head_input);
-		_assert_(residual_input);
 		
+		inefanalysis = new HydrologyDCInefficientAnalysis();
+		hmax = inefanalysis->GetHydrologyDCInefficientHmax(element,gauss,thick_input,base_input);
+		delete inefanalysis;
+
 		sed_head_input->GetInputValue(&sediment_head,gauss);
 		epl_head_input->GetInputValue(&epl_head,gauss);
-		residual_input->GetInputValue(&sed_residual,gauss);
 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
 		
 		if(epl_head>sediment_head){  
-			if(sed_residual>0.0){
+			if(sediment_head>=hmax){
 				transfer=0.0;
 			}
 			else{
@@ -430,19 +435,18 @@
 	default:
 		_error_("no case higher than 1 for the Transfer method");
 	}
-	/* if(element->Id()==42){ */
-	/* 	printf("Transferefficient Kmat %e, %e, %e, %e \n",transfer,sediment_head,epl_head,sed_residual); */
-	/* } */
 	return transfer;
 }/*}}}*/
 
-IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* residual_input){/*{{{*/
+IssmDouble HydrologyDCEfficientAnalysis::GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input){/*{{{*/
 
 	int transfermethod;
-	IssmDouble sed_residual;
+	IssmDouble hmax;
 	IssmDouble epl_head,sediment_head;
 	IssmDouble leakage,transfer;
 
+	HydrologyDCInefficientAnalysis* inefanalysis = NULL;
+
 	element->FindParam(&transfermethod,HydrologydcTransferFlagEnum);
 
 	/*Switch between the different transfer methods cases*/
@@ -454,15 +458,17 @@
 	case 1:
 		_assert_(sed_head_input);
 		_assert_(epl_head_input);
-		_assert_(residual_input);
+
+		inefanalysis = new HydrologyDCInefficientAnalysis();
+		hmax = inefanalysis->GetHydrologyDCInefficientHmax(element,gauss,thick_input,base_input);
+		delete inefanalysis;
 		
 		sed_head_input->GetInputValue(&sediment_head,gauss);
 		epl_head_input->GetInputValue(&epl_head,gauss);
-		residual_input->GetInputValue(&sed_residual,gauss);
 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
 
  		if(epl_head>sediment_head){  
-			if(sed_residual>0.0){
+			if(sediment_head>=hmax){
 				transfer=0.0;
 			}
 			else{
@@ -476,9 +482,6 @@
 	default:
 		_error_("no case higher than 1 for the Transfer method");
 	}
-	/* if(element->Id()==42){ */
-	/* 	printf("Transferefficient Pvec %e, %e, %e, %e\n",transfer,sediment_head,epl_head,sed_residual); */
-	/* } */
 	return transfer;
 }/*}}}*/
 
Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h
===================================================================
--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 18644)
+++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.h	(revision 18645)
@@ -35,8 +35,8 @@
 		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
 		IssmDouble EplSpecificStoring(Element* element);
 		IssmDouble SedimentStoring(Element* element);
-		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* residual_input);
-		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* residual_input);
+		IssmDouble GetHydrologyKMatrixTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input);
+		IssmDouble GetHydrologyPVectorTransfer(Element* element, Gauss* gauss, Input* sed_head_input, Input* epl_head_input, Input* thick_input, Input* base_input);
 		void HydrologyEPLGetMask(Vector<IssmDouble>* vec_mask,Element* element);
 		void HydrologyEPLGetActive(Vector<IssmDouble>* active_vec, Element* element);
 		void GetHydrologyDCInefficientHmax(IssmDouble* ph_max,Element* element, Node* innode);
Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
===================================================================
--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 18644)
+++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 18645)
@@ -199,8 +199,8 @@
 	Input* SedTrans_input = basalelement->GetInput(HydrologydcSedimentTransmitivityEnum); _assert_(SedTrans_input);
 	Input* sed_head_input = basalelement->GetInput(SedimentHeadEnum);
 	Input* epl_head_input = basalelement->GetInput(EplHeadEnum);
+	Input* thick_input    = basalelement->GetInput(ThicknessEnum);
 	Input* base_input     = basalelement->GetInput(BaseEnum);
-	Input* thick_input    = basalelement->GetInput(ThicknessEnum);
 
 	IssmDouble sediment_storing = SedimentStoring(basalelement);
 	/*Transfer related Inputs*/
@@ -303,8 +303,8 @@
 	Input* sed_head_input = basalelement->GetInput(SedimentHeadEnum);
 	Input* epl_head_input = basalelement->GetInput(EplHeadEnum);
 	Input* water_input    = basalelement->GetInput(BasalforcingsGroundediceMeltingRateEnum); _assert_(water_input);
+	Input* thick_input    = basalelement->GetInput(ThicknessEnum);
 	Input* base_input     = basalelement->GetInput(BaseEnum);
-	Input* thick_input    = basalelement->GetInput(ThicknessEnum);
 	if(dt!= 0.){old_wh_input = basalelement->GetInput(SedimentHeadOldEnum);                     _assert_(old_wh_input);}
 
 	IssmDouble sediment_storing    = SedimentStoring(basalelement);
@@ -598,9 +598,6 @@
 			if(sediment_head>=hmax){
 				transfer=0.0;
 			}
-			else if(sediment_head>=hmax-50.0){
-				transfer=leakage*1.0e-2;
-			}
 			else{
 				transfer=(leakage);
 			}
@@ -612,9 +609,6 @@
 	default:
 		_error_("no case higher than 1 for the Transfer method");
 	}
-	/* if(element->Id()==42){ */
-	/* 	printf("TransferInfficient Kmat %e, %e, %e\n",transfer,sediment_head,epl_head); */
-	/* } */
 	return transfer;
 }/*}}}*/
 
@@ -647,9 +641,6 @@
 			if(sediment_head>=hmax){
 				transfer=0.0;
 			}
-			else if(sediment_head>=hmax-50.0){
-				transfer=leakage*1.0e-2;
-			}
 			else{
 				transfer=(epl_head*leakage);
 			}
@@ -661,9 +652,6 @@
 	default:
 		_error_("no case higher than 1 for the Transfer method");
 	}
-	/* if(element->Id()==42){ */
-	/* 	printf("TransferInfficient Pvec %e, %e, %e\n",transfer,sediment_head,epl_head); */
-	/* } */
 	return transfer;
 }/*}}}*/
 
