Index: /issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h
===================================================================
--- /issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h	(revision 13482)
+++ /issm/trunk-jpl/src/c/EnumDefinitions/EnumDefinitions.h	(revision 13483)
@@ -17,4 +17,5 @@
 	AutodiffDependentObjectNamesEnum,
 	AutodiffDependentObjectTypesEnum,
+	AutodiffDependentObjectIndicesEnum,
 	AutodiffDependentObjectsEnum,
 	AutodiffNumIndependentsEnum,
@@ -156,5 +157,6 @@
 	PrognosticRequestedOutputsEnum,
 	QmuIsdakotaEnum,
-	QmuMassFluxSegmentsEnum,
+	MassFluxSegmentsEnum,
+	MassFluxSegmentsPresentEnum,
 	QmuNumberofpartitionsEnum,
 	QmuNumberofresponsesEnum,
Index: /issm/trunk-jpl/src/c/classes/objects/DependentObject.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/DependentObject.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/classes/objects/DependentObject.cpp	(revision 13483)
@@ -16,4 +16,5 @@
 #include "../../Container/Container.h"
 #include "../../include/include.h"
+#include "../../modules/Responsex/Responsex.h"
 
 /*DependentObject constructors and destructor*/
@@ -22,11 +23,13 @@
 	this->name=NoneEnum;
 	this->type=0;
+	this->index=-1;
 }
 /*}}}*/
-/*FUNCTION DependentObject::DependentObject(int in_name, int in_type){{{*/
-DependentObject::DependentObject(int in_name, int in_type){
+/*FUNCTION DependentObject::DependentObject(int in_name, int in_type, int in_index){{{*/
+DependentObject::DependentObject(int in_name, int in_type,int in_index){
 
 	this->name=in_name;
 	this->type=in_type;
+	this->index=in_index;
 	if(in_type!=0 && in_type!=1)_error_("cannot create an DependentObject of type " << in_type);
 	if(in_type==1)_error_("not implemented yet!");
@@ -52,4 +55,5 @@
 	else
 		_error_(" unknown type: " << this->type);
+	if(this->index>=0) _printLine_("   index: " << this->index);
 }
 /*}}}*/
@@ -78,5 +82,5 @@
 /*FUNCTION DependentObject::copy{{{*/
 Object* DependentObject::copy(void) { 
-	return new DependentObject(name,type);
+	return new DependentObject(name,type,index);
 } /*}}}*/
 
@@ -95,2 +99,15 @@
 }
 /*}}}*/
+/*FUNCTION DependentObject::Responsex{{{*/
+void  DependentObject::Responsex(IssmDouble* poutput_value,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters){
+
+	if(this->name==MassFluxEnum){
+
+		/*to identify the mass flux that will be computed, we need the index of the profile: */
+		parameters->SetParam(this->index,IndexEnum);
+	}
+	
+	::Responsex(poutput_value,elements,nodes,vertices,loads,materials,parameters,this->name,false,0);
+
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/DependentObject.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/DependentObject.h	(revision 13482)
+++ /issm/trunk-jpl/src/c/classes/objects/DependentObject.h	(revision 13483)
@@ -10,4 +10,11 @@
 #include "../../shared/shared.h"
 /*}}}*/
+		
+class Elements;
+class Nodes;
+class Vertices;
+class Loads;
+class Materials;
+class Parameters;
 
 class DependentObject: public Object{
@@ -17,8 +24,9 @@
 		int name;
 		int type;  /*0: scalar, 1: vertex*/
+		int index;  /*0: scalar, 1: vertex*/
 		
 		/*DependentObject constructors, destructors {{{*/
 		DependentObject();
-		DependentObject(int name, int type);
+		DependentObject(int name, int type,int index);
 		~DependentObject();
 		/*}}}*/
@@ -34,4 +42,5 @@
 		/*DependentObject methods: */
 		int  NumDependents(void);
+		void Responsex(IssmDouble* poutput_value,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters);
 
 };
Index: /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13483)
@@ -22,4 +22,5 @@
 		case AutodiffDependentObjectNamesEnum : return "AutodiffDependentObjectNames";
 		case AutodiffDependentObjectTypesEnum : return "AutodiffDependentObjectTypes";
+		case AutodiffDependentObjectIndicesEnum : return "AutodiffDependentObjectIndices";
 		case AutodiffDependentObjectsEnum : return "AutodiffDependentObjects";
 		case AutodiffNumIndependentsEnum : return "AutodiffNumIndependents";
@@ -161,5 +162,6 @@
 		case PrognosticRequestedOutputsEnum : return "PrognosticRequestedOutputs";
 		case QmuIsdakotaEnum : return "QmuIsdakota";
-		case QmuMassFluxSegmentsEnum : return "QmuMassFluxSegments";
+		case MassFluxSegmentsEnum : return "MassFluxSegments";
+		case MassFluxSegmentsPresentEnum : return "MassFluxSegmentsPresent";
 		case QmuNumberofpartitionsEnum : return "QmuNumberofpartitions";
 		case QmuNumberofresponsesEnum : return "QmuNumberofresponses";
Index: /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/MassFluxx/MassFluxx.cpp	(revision 13483)
@@ -15,4 +15,5 @@
 	Element *element    = NULL;
 	int      element_id;
+	bool     ispresent=false;
 	
 	/*output: */
@@ -32,5 +33,8 @@
 
 	/*First, figure out which segment to compute our mass flux on. Start with retrieving qmu_mass_flux_segments: */
-	parameters->FindParam(&array,&M,&mdims_array,&ndims_array,QmuMassFluxSegmentsEnum);
+	parameters->FindParam(&ispresent,MassFluxSegmentsPresentEnum);
+	if(!ispresent)_error_("no mass flux segments available!");
+
+	parameters->FindParam(&array,&M,&mdims_array,&ndims_array,MassFluxSegmentsEnum);
 
 	/*Retrieve index of segments being used for MassFlux computation: */
@@ -40,5 +44,5 @@
 	segments=array[counter-1]; //matlab to "C" indexing
 	num_segments=mdims_array[counter-1];
-
+	
 	/*Go through segments, and then elements, and figure out which elements belong to a segment. 
 	 * When we find one, use the element to compute the mass flux on the segment: */
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/Autodiff/CreateParametersAutodiff.cpp	(revision 13483)
@@ -61,7 +61,8 @@
 			iomodel->FetchData(&names,&dummy,&dummy,AutodiffDependentObjectNamesEnum);
 			iomodel->FetchData(&types,&dummy,&dummy,AutodiffDependentObjectTypesEnum);
+			iomodel->FetchData(&indices,&dummy,&dummy,AutodiffDependentObjectIndicesEnum);
 
 			for(i=0;i<num_dependent_objects;i++){
-				DependentObject* dep=new DependentObject(names[i],types[i]);
+				DependentObject* dep=new DependentObject(names[i],types[i],indices[i]);
 				dependent_objects->AddObject(dep);
 				num_dep+=dep->NumDependents();
@@ -77,5 +78,4 @@
 		delete dependent_objects;
 		/*}}}*/
-
 		/*Deal with independents: {{{*/
 
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 13483)
@@ -21,9 +21,21 @@
 void CreateParameters(Parameters** pparameters,IoModel* iomodel,char* rootpath,const int solution_type,int analysis_type,int analysis_counter){
 	
-	int         i;
+	int         i,j,m,k;
 	int         numoutputs;
 	Parameters *parameters       = NULL;
 	IssmDouble *requestedoutputs = NULL;
 	bool        isdelta18o;
+
+	/*parameters for mass flux: {{{*/
+	int      mass_flux_num_profiles=0;
+	bool     mass_flux_present=false;
+	IssmDouble** array=NULL;
+	int*     mdims_array=NULL;
+	int*     ndims_array=NULL;
+	IssmDouble*  temp_matrix=NULL;
+	int      temp_m,temp_n;
+	IssmDouble*  matrix=NULL;
+	int      count;
+	/*}}}*/
 
 	if(*pparameters)return; //do not create parameters twice!
@@ -142,4 +154,62 @@
 	if(numoutputs)parameters->AddObject(new IntVecParam(PrognosticRequestedOutputsEnum,requestedoutputs,numoutputs));
 	iomodel->DeleteData(requestedoutputs,PrognosticRequestedOutputsEnum);
+		
+	
+	/*Deal with mass flux segments: {{{*/
+	iomodel->FetchData(&mass_flux_present,MassFluxSegmentsPresentEnum);
+	parameters->AddObject(new BoolParam(MassFluxSegmentsPresentEnum,mass_flux_present));
+
+	if(mass_flux_present){
+
+		/*Fetch the mass flux segments necessary to compute the mass fluxes.  Build a DoubleMatArrayParam object out of them: */ 
+		iomodel->FetchData(&array,&mdims_array,&ndims_array,&mass_flux_num_profiles,MassFluxSegmentsEnum);
+		if(mass_flux_num_profiles==0)_error_("mass_flux_num_profiles is 0, when MassFlux computations were requested!");
+
+		/*Go through segments, and extract those that belong to this cpu: */
+		for(i=0;i<mass_flux_num_profiles;i++){
+			temp_matrix=array[i];
+			temp_m=mdims_array[i];
+			temp_n=ndims_array[i];
+
+			m=0;
+			for(j=0;j<temp_m;j++){
+				if (  iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1] )m++;
+			}
+			if(m){
+				matrix=xNewZeroInit<IssmDouble>(5*m);
+				count=0;
+				for(j=0;j<temp_m;j++){
+					if (iomodel->my_elements[reCast<int>(*(temp_matrix+5*j+4))-1]){
+						for(k=0;k<5;k++)*(matrix+5*count+k)=*(temp_matrix+5*j+k);
+						count++;
+					}
+				}
+			}
+			else{
+				matrix=NULL;
+			}
+
+			/*Assign: */
+			array[i]=matrix;
+			mdims_array[i]=m;
+			ndims_array[i]=5;
+
+			/*Free temporary matrix: */
+			xDelete<IssmDouble>(temp_matrix);
+		}
+
+		/*Ok, we have an array of segments, different on every cpu. Create a DoubleMatArrayParam object with it: */
+		parameters->AddObject(new DoubleMatArrayParam(MassFluxSegmentsEnum,array,mass_flux_num_profiles,mdims_array,ndims_array));
+
+		/*Free data: */
+		for(i=0;i<mass_flux_num_profiles;i++){
+			IssmDouble* matrix=array[i];
+			xDelete<IssmDouble>(matrix);
+		}
+		xDelete<int>(mdims_array); 
+		xDelete<int>(ndims_array);
+		xDelete<IssmDouble*>(array);
+	}
+	/*}}}*/
 
 	/*Before returning, create parameters in case we are running Qmu or control types runs: */
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/Dakota/CreateParametersDakota.cpp	(revision 13483)
@@ -39,17 +39,7 @@
 	char tag[50];
 	
-	/*parameters for mass flux: */
-	bool     qmu_mass_flux_present=false;
-	int qmu_mass_flux_num_profiles=0;
-	double** array=NULL;
-	int*     mdims_array=NULL;
-	int*     ndims_array=NULL;
-	
-	double*  matrix=NULL;
-	double*  temp_matrix=NULL;
+			
 	int      M;
-	int      temp_m,temp_n;
 	int      m,n;
-	int      count;
 	bool     dakota_analysis=false;
 	char*    name=NULL;
@@ -140,65 +130,4 @@
 		}
 		/*}}}*/
-		/*Deal with data needed to compute qmu responses: {{{*/
-		for(i=0;i<numresponsedescriptors;i++){
-			
-			if(strncmp(responsedescriptors[i],"indexed_MassFlux",16)==0){
-				qmu_mass_flux_present=true;
-			}
-		}
-		
-		
-		if(qmu_mass_flux_present){
-			
-			/*Fetch the mass flux segments necessary to compute the mass fluxes.  Build a DoubleMatArrayParam object out of them: */ 
-			iomodel->FetchData(&array,&mdims_array,&ndims_array,&qmu_mass_flux_num_profiles,QmuMassFluxSegmentsEnum);
-			if(qmu_mass_flux_num_profiles==0)_error_("qmu_mass_flux_num_profiles is 0, when MassFlux computations were requested!");
-
-			/*Go through segments, and extract those that belong to this cpu: */
-			for(i=0;i<qmu_mass_flux_num_profiles;i++){
-				temp_matrix=array[i];
-				temp_m=mdims_array[i];
-				temp_n=ndims_array[i];
-
-				m=0;
-				for(j=0;j<temp_m;j++){
-					if (  iomodel->my_elements[(int)(*(temp_matrix+5*j+4))-1])m++;
-				}
-				if(m){
-					matrix=xNewZeroInit<double>(5*m);
-					count=0;
-					for(j=0;j<temp_m;j++){
-						if (iomodel->my_elements[(int)*(temp_matrix+5*j+4)-1]){
-							for(k=0;k<5;k++)*(matrix+5*count+k)=*(temp_matrix+5*j+k);
-							count++;
-						}
-					}
-				}
-				else{
-					matrix=NULL;
-				}
-
-				/*Assign: */
-				array[i]=matrix;
-				mdims_array[i]=m;
-				ndims_array[i]=5;
-
-				/*Free temporary matrix: */
-				xDelete<double>(temp_matrix);
-			}
-
-			/*Ok, we have an array of segments, different on every cpu. Create a DoubleMatArrayParam object with it: */
-			parameters->AddObject(new DoubleMatArrayParam(QmuMassFluxSegmentsEnum,array,qmu_mass_flux_num_profiles,mdims_array,ndims_array));
-
-			/*Free data: */
-			for(i=0;i<qmu_mass_flux_num_profiles;i++){
-				double* matrix=array[i];
-				xDelete<double>(matrix);
-			}
-			xDelete<int>(mdims_array); 
-			xDelete<int>(ndims_array);
-			xDelete<double*>(array);
-		}
-		/*}}}*/
 		/*Free data: {{{*/
 		for(i=0;i<numresponsedescriptors;i++){
Index: /issm/trunk-jpl/src/c/modules/RequestedDependentsx/RequestedDependentsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/RequestedDependentsx/RequestedDependentsx.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/RequestedDependentsx/RequestedDependentsx.cpp	(revision 13483)
@@ -34,5 +34,5 @@
 			for(i=0;i<dependent_objects->Size();i++){
 				DependentObject* dep=(DependentObject*)dependent_objects->GetObjectByOffset(i);
-				Responsex(&output_value,elements,nodes,vertices,loads,materials,parameters,dep->name,false,0);
+				dep->Responsex(&output_value,elements,nodes,vertices,loads,materials,parameters);
 				output_value>>=dependents[i];
 			}
Index: /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13482)
+++ /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13483)
@@ -23,4 +23,5 @@
 	      else if (strcmp(name,"AutodiffDependentObjectNames")==0) return AutodiffDependentObjectNamesEnum;
 	      else if (strcmp(name,"AutodiffDependentObjectTypes")==0) return AutodiffDependentObjectTypesEnum;
+	      else if (strcmp(name,"AutodiffDependentObjectIndices")==0) return AutodiffDependentObjectIndicesEnum;
 	      else if (strcmp(name,"AutodiffDependentObjects")==0) return AutodiffDependentObjectsEnum;
 	      else if (strcmp(name,"AutodiffNumIndependents")==0) return AutodiffNumIndependentsEnum;
@@ -137,9 +138,9 @@
 	      else if (strcmp(name,"MeshElementonbed")==0) return MeshElementonbedEnum;
 	      else if (strcmp(name,"MeshElementonsurface")==0) return MeshElementonsurfaceEnum;
-	      else if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
          else stage=2;
    }
    if(stage==2){
-	      if (strcmp(name,"MeshElements")==0) return MeshElementsEnum;
+	      if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
+	      else if (strcmp(name,"MeshElements")==0) return MeshElementsEnum;
 	      else if (strcmp(name,"MeshLowerelements")==0) return MeshLowerelementsEnum;
 	      else if (strcmp(name,"MeshNumberofedges")==0) return MeshNumberofedgesEnum;
@@ -165,5 +166,6 @@
 	      else if (strcmp(name,"PrognosticRequestedOutputs")==0) return PrognosticRequestedOutputsEnum;
 	      else if (strcmp(name,"QmuIsdakota")==0) return QmuIsdakotaEnum;
-	      else if (strcmp(name,"QmuMassFluxSegments")==0) return QmuMassFluxSegmentsEnum;
+	      else if (strcmp(name,"MassFluxSegments")==0) return MassFluxSegmentsEnum;
+	      else if (strcmp(name,"MassFluxSegmentsPresent")==0) return MassFluxSegmentsPresentEnum;
 	      else if (strcmp(name,"QmuNumberofpartitions")==0) return QmuNumberofpartitionsEnum;
 	      else if (strcmp(name,"QmuNumberofresponses")==0) return QmuNumberofresponsesEnum;
@@ -259,10 +261,10 @@
 	      else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;
 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
-	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
-	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+	      if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
+	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
 	      else if (strcmp(name,"HutterApproximation")==0) return HutterApproximationEnum;
 	      else if (strcmp(name,"MacAyealApproximation")==0) return MacAyealApproximationEnum;
@@ -382,10 +384,10 @@
 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
-	      else if (strcmp(name,"TemperatureOld")==0) return TemperatureOldEnum;
-	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"TemperatureSurface")==0) return TemperatureSurfaceEnum;
+	      if (strcmp(name,"TemperatureOld")==0) return TemperatureOldEnum;
+	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+	      else if (strcmp(name,"TemperatureSurface")==0) return TemperatureSurfaceEnum;
 	      else if (strcmp(name,"TemperatureBasal")==0) return TemperatureBasalEnum;
 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
@@ -505,10 +507,10 @@
 	      else if (strcmp(name,"XY")==0) return XYEnum;
 	      else if (strcmp(name,"XYZP")==0) return XYZPEnum;
-	      else if (strcmp(name,"Option")==0) return OptionEnum;
-	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
+	      if (strcmp(name,"Option")==0) return OptionEnum;
+	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
+	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
 	      else if (strcmp(name,"OptionChar")==0) return OptionCharEnum;
 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
Index: /issm/trunk-jpl/src/m/classes/autodiff.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/autodiff.m	(revision 13482)
+++ /issm/trunk-jpl/src/m/classes/autodiff.m	(revision 13483)
@@ -58,5 +58,5 @@
 			if ~obj.isautodiff, return; end
 
-			%process dependent variables
+			%process dependent variables {{{
 			num_dependent_objects=numel(obj.dependents);
 			WriteData(fid,'data',num_dependent_objects,'enum',AutodiffNumDependentObjectsEnum(),'format','Integer');
@@ -65,4 +65,5 @@
 				names=zeros(num_dependent_objects,1);
 				types=zeros(num_dependent_objects,1);
+				indices=zeros(num_dependent_objects,1);
 
 				for i=1:num_dependent_objects,
@@ -71,11 +72,12 @@
 					names(i)=StringToEnum(dep.name);
 					types(i)=dep.typetoscalar();
+					indices(i)=dep.index;
 				end
 				WriteData(fid,'data',names,'enum',AutodiffDependentObjectNamesEnum(),'format','IntMat','mattype',3);
 				WriteData(fid,'data',types,'enum',AutodiffDependentObjectTypesEnum(),'format','IntMat','mattype',3);
+				WriteData(fid,'data',indices,'enum',AutodiffDependentObjectIndicesEnum(),'format','IntMat','mattype',3);
 			end
-			
-			
-			%process independent variables
+			%}}}
+			%process independent variables {{{
 			num_independent_objects=numel(obj.independents);
 			WriteData(fid,'data',num_independent_objects,'enum',AutodiffNumIndependentObjectsEnum(),'format','Integer');
@@ -94,6 +96,6 @@
 				WriteData(fid,'data',types,'enum',AutodiffIndependentObjectTypesEnum(),'format','IntMat','mattype',3);
 			end
-
-			%if driver is fos_forward, build index: 
+			%}}}
+			%if driver is fos_forward, build index:  {{{
 			if strcmpi(obj.driver,'fos_forward'),
 				index=0;
@@ -115,5 +117,6 @@
 				WriteData(fid,'data',index,'enum',AutodiffFosForwardIndexEnum(),'format','Integer'); 
 			end
-			%if driver is fov_forward, build indices: 
+			%}}}
+			%if driver is fov_forward, build indices:  {{{
 			if strcmpi(obj.driver,'fov_forward'),
 				indices=0;
@@ -136,4 +139,19 @@
 				WriteData(fid,'data',indices,'enum',AutodiffFovForwardIndicesEnum,'format','IntMat','mattype',3);
 			end
+			%}}}
+			%deal with mass fluxes:  {{{
+			mass_flux_segments=cell(0,1);
+			for i=1:num_dependent_objects,
+				dep=obj.dependents{i};
+				if strcmpi(dep.name,'MassFlux'),
+					mass_flux_segments{end+1,1}=dep.segments;
+				end
+			end
+			if ~isempty(mass_flux_segments),
+				WriteData(fid,'data',mass_flux_segments,'enum',MassFluxSegmentsEnum,'format','MatArray');
+				flag=true;
+				WriteData(fid,'data',flag,'enum',MassFluxSegmentsPresentEnum,'format','Boolean');
+			end
+			%}}}
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/dependent.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/dependent.m	(revision 13482)
+++ /issm/trunk-jpl/src/m/classes/dependent.m	(revision 13483)
@@ -8,4 +8,7 @@
 		name                 = '';
 		type                 = '';
+		exp                  = '';
+		segments             = [];
+		index                = -1;
 	end
 	methods
@@ -14,16 +17,36 @@
 			 %use provided options to change fields
 			 options=pairoptions(varargin{:});
+				
+			 obj.name=getfieldvalue(options,'name','');
+			 obj.type=getfieldvalue(options,'type','');
+			 obj.exp=getfieldvalue(options,'exp','');
+			 obj.segments=getfieldvalue(options,'segments',[]);
+			 obj.index=getfieldvalue(options,'index',-1);
 
-			 %OK get other fields
-			 obj=AssignObjectFields(pairoptions(varargin{:}),obj);
-
+			 %if name is mass flux: 
+			 if strcmpi(obj.name,'MassFlux'),
+				 %make sure that we supplied a file and that it exists! 
+				 if exist(obj.exp)~=2,
+					 error('dependent checkconsistency: specified ''exp'' file does not exist!');
+				 end
+				 %process the file and retrieve segments
+				 mesh=getfieldvalue(options,'mesh');
+				 obj.segments=MeshProfileIntersection(mesh.elements,mesh.x,mesh.y,obj.exp);
+			 end
 		 end
 		 %}}}
 		function obj = setdefaultparameters(obj) % {{{
-			%do nothing
-
+		%do nothing
 		end % }}}
 		function md = checkconsistency(obj,md,solution,analyses) % {{{
 			%do nothing for now
+			if strcmpi(obj.name,'MassFlux'),
+				if isempty(obj.segments),
+					error('dependent checkconsistency error: need segments to compute this dependent response');
+				end
+				if obj.index<=0,
+					error('dependent checkconsistency error: index for segments should be >=1');
+				end
+			end
 
 		end % }}}
@@ -33,4 +56,8 @@
 			fielddisplay(obj,'name','variable name (must match corresponding Enum)');
 			fielddisplay(obj,'type','type of variable (''vertex'' or ''scalar'')');
+			if ~isempty(obj.exp),
+				fielddisplay(obj,'exp','file needed to compute dependent variable');
+				fielddisplay(obj,'segments','mass flux segments');
+			end
 
 		end % }}}
Index: /issm/trunk-jpl/src/m/classes/qmu.m
===================================================================
--- /issm/trunk-jpl/src/m/classes/qmu.m	(revision 13482)
+++ /issm/trunk-jpl/src/m/classes/qmu.m	(revision 13483)
@@ -148,5 +148,9 @@
 			WriteData(fid,'object',obj,'fieldname','variabledescriptors','format','StringArray');
 			WriteData(fid,'object',obj,'fieldname','responsedescriptors','format','StringArray');
-			WriteData(fid,'object',obj,'fieldname','mass_flux_segments','format','MatArray');
+			WriteData(fid,'data',obj.mass_flux_segments,'enum',MassFluxSegmentsEnum,'format','MatArray');
+			if ~isempty(mass_flux_segments),
+				flag=true;
+				WriteData(fid,'data',flag,'enum',MassFluxSegmentsPrsentEnum,'format','Boolean');
+			end
 		end % }}}
 	end
Index: /issm/trunk-jpl/src/m/enum/AutodiffDependentObjectIndicesEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/AutodiffDependentObjectIndicesEnum.m	(revision 13483)
+++ /issm/trunk-jpl/src/m/enum/AutodiffDependentObjectIndicesEnum.m	(revision 13483)
@@ -0,0 +1,11 @@
+function macro=AutodiffDependentObjectIndicesEnum()
+%AUTODIFFDEPENDENTOBJECTINDICESENUM - Enum of AutodiffDependentObjectIndices
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=AutodiffDependentObjectIndicesEnum()
+
+macro=StringToEnum('AutodiffDependentObjectIndices');
Index: /issm/trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 13482)
+++ /issm/trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 13483)
@@ -59,4 +59,14 @@
 	return StringToEnum('AutodiffDependentObjectTypes')[0]
 
+def AutodiffDependentObjectIndicesEnum():
+	"""
+	AUTODIFFDEPENDENTOBJECTINDICESENUM - Enum of AutodiffDependentObjectIndices
+
+	   Usage:
+	      macro=AutodiffDependentObjectIndicesEnum()
+	"""
+
+	return StringToEnum('AutodiffDependentObjectIndices')[0]
+
 def AutodiffDependentObjectsEnum():
 	"""
@@ -1449,13 +1459,23 @@
 	return StringToEnum('QmuIsdakota')[0]
 
-def QmuMassFluxSegmentsEnum():
-	"""
-	QMUMASSFLUXSEGMENTSENUM - Enum of QmuMassFluxSegments
-
-	   Usage:
-	      macro=QmuMassFluxSegmentsEnum()
-	"""
-
-	return StringToEnum('QmuMassFluxSegments')[0]
+def MassFluxSegmentsEnum():
+	"""
+	MASSFLUXSEGMENTSENUM - Enum of MassFluxSegments
+
+	   Usage:
+	      macro=MassFluxSegmentsEnum()
+	"""
+
+	return StringToEnum('MassFluxSegments')[0]
+
+def MassFluxSegmentsPresentEnum():
+	"""
+	MASSFLUXSEGMENTSPRESENTENUM - Enum of MassFluxSegmentsPresent
+
+	   Usage:
+	      macro=MassFluxSegmentsPresentEnum()
+	"""
+
+	return StringToEnum('MassFluxSegmentsPresent')[0]
 
 def QmuNumberofpartitionsEnum():
@@ -4887,4 +4907,4 @@
 	"""
 
-	return 487
-
+	return 489
+
Index: /issm/trunk-jpl/src/m/enum/MassFluxSegmentsEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MassFluxSegmentsEnum.m	(revision 13483)
+++ /issm/trunk-jpl/src/m/enum/MassFluxSegmentsEnum.m	(revision 13483)
@@ -0,0 +1,11 @@
+function macro=MassFluxSegmentsEnum()
+%MASSFLUXSEGMENTSENUM - Enum of MassFluxSegments
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=MassFluxSegmentsEnum()
+
+macro=StringToEnum('MassFluxSegments');
Index: /issm/trunk-jpl/src/m/enum/MassFluxSegmentsPresentEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MassFluxSegmentsPresentEnum.m	(revision 13483)
+++ /issm/trunk-jpl/src/m/enum/MassFluxSegmentsPresentEnum.m	(revision 13483)
@@ -0,0 +1,11 @@
+function macro=MassFluxSegmentsPresentEnum()
+%MASSFLUXSEGMENTSPRESENTENUM - Enum of MassFluxSegmentsPresent
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=MassFluxSegmentsPresentEnum()
+
+macro=StringToEnum('MassFluxSegmentsPresent');
Index: /issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m	(revision 13482)
+++ /issm/trunk-jpl/src/m/enum/MaximumNumberOfEnums.m	(revision 13483)
@@ -9,3 +9,3 @@
 %      macro=MaximumNumberOfEnums()
 
-macro=487;
+macro=489;
Index: sm/trunk-jpl/src/m/enum/QmuMassFluxSegmentsEnum.m
===================================================================
--- /issm/trunk-jpl/src/m/enum/QmuMassFluxSegmentsEnum.m	(revision 13482)
+++ 	(revision )
@@ -1,11 +1,0 @@
-function macro=QmuMassFluxSegmentsEnum()
-%QMUMASSFLUXSEGMENTSENUM - Enum of QmuMassFluxSegments
-%
-%   WARNING: DO NOT MODIFY THIS FILE
-%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
-%            Please read src/c/EnumDefinitions/README for more information
-%
-%   Usage:
-%      macro=QmuMassFluxSegmentsEnum()
-
-macro=StringToEnum('QmuMassFluxSegments');
Index: /issm/trunk-jpl/test/NightlyRun/ad.m
===================================================================
--- /issm/trunk-jpl/test/NightlyRun/ad.m	(revision 13482)
+++ /issm/trunk-jpl/test/NightlyRun/ad.m	(revision 13483)
@@ -1,3 +1,3 @@
-md=triangle(model,'../Exp/Square.exp',50000);
+md=triangle(model,'../Exp/Square.exp',100000);
 md=setmask(md,'all','');
 md=parameterize(md,'../Par/SquareShelfConstrained.par');
@@ -15,7 +15,15 @@
 	dependent('name','IceVolume','type','scalar')...
 	dependent('name','MaxVel','type','scalar')...
+	dependent('name','MassFlux','type','scalar','exp','../Exp/MassFlux1.exp','mesh',md.mesh,'index',1)...
+	dependent('name','MassFlux','type','scalar','exp','../Exp/MassFlux2.exp','mesh',md.mesh,'index',2)...
 	};
+
 %md.autodiff.driver='fos_forward';
 md.autodiff.driver='fov_forward';
 
 md=solve(md,TransientSolutionEnum);
+
+%plot
+nods=md.mesh.numberofvertices;
+jac=md.results.TransientSolution(1).AutodiffJacobian;
+plotmodel(md,'data',jac(1:nods),'data',jac(nods+1:2*nods),'data',jac(2*nods+1:3*nods),'data',jac(3*nods+1:4*nods));
