Index: issm/trunk/src/m/dakota/process_qmu_response_data.m
===================================================================
--- issm/trunk/src/m/dakota/process_qmu_response_data.m	(revision 4429)
+++ issm/trunk/src/m/dakota/process_qmu_response_data.m	(revision 4430)
@@ -9,14 +9,51 @@
 
 for i=1:numel(md.responsedescriptors),
-	if strcmpi(md.responsedescriptors{i},'mass_flux'),
+	if strncmpi(md.responsedescriptors{i},'mass_flux',9),
+		indx=str2int(md.responsedescriptors{i}(10:end));
+		if isempty(indx) || ~indx
+			indx=1;
+		end
+
 		%we need a profile of points on which to compute the mass_flux, is it here? 
 		if isnans(md.qmu_mass_flux_profile),
 			error('process_qmu_response_data error message: could not find a mass_flux exp profile!');
 		end
-		if ~ischar(md.qmu_mass_flux_profile),
+		if ~(ischar(md.qmu_mass_flux_profile) && (indx == 1)) && ...
+		   ~(iscell(md.qmu_mass_flux_profile) && length(md.qmu_mass_flux_profile) >= indx && ischar(md.qmu_mass_flux_profile{indx})),
 			error('process_qmu_response_data error message: mass_flux exp profile should be a domain outline name');
 		end
+
 		%ok, process the qmu_mass_flux_profile to build a list of segments: 
-		md.qmu_mass_flux_segments=MassFluxProcessProfile(md);
+		if ischar(md.qmu_mass_flux_profile),
+			md.qmu_mass_flux_segments=MassFluxProcessProfile(md);
+			md.qmu_mass_flux_num_segments=size(md.qmu_mass_flux_segments,1);
+		else
+			if isempty(md.qmu_mass_flux_segments) || ~iscell(md.qmu_mass_flux_segments)
+				md.qmu_mass_flux_segments=cell(numel(md.qmu_mass_flux_profile),1);
+			end
+			if isempty(md.qmu_mass_flux_num_segments) || ...
+			   (numel(md.qmu_mass_flux_num_segments) == 1 && isnan(md.qmu_mass_flux_num_segments))
+				md.qmu_mass_flux_num_segments=zeros(numel(md.qmu_mass_flux_profile),1);
+			end
+			save=md.qmu_mass_flux_profile;
+			md.qmu_mass_flux_profile=md.qmu_mass_flux_profile{indx};
+			md.qmu_mass_flux_segments{indx,1}=MassFluxProcessProfile(md);
+			md.qmu_mass_flux_num_segments(indx,1)=size(md.qmu_mass_flux_segments{indx},1);
+			md.qmu_mass_flux_profile=save;
+			clear save
+		end
 	end
 end
+
+% for now, concatenate all segments from cells to make a double array for parallel
+if iscell(md.qmu_mass_flux_segments)
+	segments=zeros(0,5);
+	for i=1:length(md.qmu_mass_flux_num_segments)
+		if md.qmu_mass_flux_num_segments(i)
+			segments=[segments; md.qmu_mass_flux_segments{i}];
+		end
+	end
+	md.qmu_mass_flux_segments=segments;
+	clear segments
+end
+
Index: issm/trunk/src/m/dakota/qmuresponse.m
===================================================================
--- issm/trunk/src/m/dakota/qmuresponse.m	(revision 4429)
+++ issm/trunk/src/m/dakota/qmuresponse.m	(revision 4430)
@@ -8,28 +8,77 @@
 elseif strcmpi(descriptor,'max_vx'),
 	response=max(processedresults.vx);
+elseif strcmpi(descriptor,'max_abs_vx'),
+	response=max(abs(processedresults.vx));
 elseif strcmpi(descriptor,'min_vx'),
 	response=min(processedresults.vx);
 elseif strcmpi(descriptor,'max_vy'),
 	response=max(processedresults.vy);
+elseif strcmpi(descriptor,'max_abs_vy'),
+	response=max(abs(processedresults.vy));
 elseif strcmpi(descriptor,'min_vy'),
 	response=min(processedresults.vy);
-elseif strcmpi(descriptor,'mass_flux'),
+elseif strncmpi(descriptor,'mass_flux',9),
+	indx=str2int(descriptor(10:end));
+	if isempty(indx) || ~indx
+		indx=1;
+	end
+
 	%call mass flux module.
 	m_dh=models.dh;
 	m_dhu=models.dhu;
 	m_ds=models.ds;
-	ishutter=m_dh.parameters.ishutter;
-	ismacayealpattyn=m_dhu.parameters.ismacayealpattyn;
+	ishutter=m_dhu.parameters.ishutter;
+	ismacayealpattyn=m_dh.parameters.ismacayealpattyn;
 	isstokes=m_ds.parameters.isstokes;
 	if ishutter,
-		response=MassFlux(m_dhu.elements,m_dhu.nodes,m_dhu.vertices,m_dhu.loads,m_dhu.materials,m_dhu.parameters,results.u_g);
+		if isnumeric(m_dhu.parameters.qmu_mass_flux_segments)
+			response=MassFlux(m_dhu.elements,m_dhu.nodes,m_dhu.vertices,m_dhu.loads,m_dhu.materials,m_dhu.parameters,results.u_g);
+		else
+			save=m_dhu.parameters.qmu_mass_flux_segments;
+			m_dhu.parameters.qmu_mass_flux_segments=m_dhu.parameters.qmu_mass_flux_segments{indx};
+			response=MassFlux(m_dhu.elements,m_dhu.nodes,m_dhu.vertices,m_dhu.loads,m_dhu.materials,m_dhu.parameters,results.u_g);
+			m_dhu.parameters.qmu_mass_flux_segments=save;
+			clear save
+		end
 	elseif ismacayealpattyn,
-		response=MassFlux(m_dh.elements,m_dh.nodes,m_dh.vertices,m_dh.loads,m_dh.materials,m_dh.parameters,results.u_g);
+
+% for now, separate all segments from double array for parallel to make cells
+	if (length(m_dh.parameters.qmu_mass_flux_num_segments) > 1)
+		segments=m_dh.parameters.qmu_mass_flux_segments;
+		m_dh.parameters.qmu_mass_flux_segments=cell(size(m_dh.parameters.qmu_mass_flux_num_segments));
+		ipt=1;
+		for i=1:length(m_dh.parameters.qmu_mass_flux_num_segments)
+			if m_dh.parameters.qmu_mass_flux_num_segments(i)
+				m_dh.parameters.qmu_mass_flux_segments{i}=segments(ipt:ipt+m_dh.parameters.qmu_mass_flux_num_segments(i)-1,:);
+				ipt=ipt+m_dh.parameters.qmu_mass_flux_num_segments(i);
+			end
+		end
+		clear segments
+	end
+
+		if isnumeric(m_dh.parameters.qmu_mass_flux_segments)
+			response=MassFlux(m_dh.elements,m_dh.nodes,m_dh.vertices,m_dh.loads,m_dh.materials,m_dh.parameters,results.u_g);
+		else
+			save=m_dh.parameters.qmu_mass_flux_segments;
+			m_dh.parameters.qmu_mass_flux_segments=m_dh.parameters.qmu_mass_flux_segments{indx};
+			response=MassFlux(m_dh.elements,m_dh.nodes,m_dh.vertices,m_dh.loads,m_dh.materials,m_dh.parameters,results.u_g);
+			m_dh.parameters.qmu_mass_flux_segments=save;
+			clear save
+		end
 	elseif isstokes,
-		response=MassFlux(m_ds.elements,m_ds.nodes,m_ds.vertices,m_ds.loads,m_ds.materials,m_ds.parameters,results.u_g);
+		if isnumeric(m_ds.parameters.qmu_mass_flux_segments)
+			response=MassFlux(m_ds.elements,m_ds.nodes,m_ds.vertices,m_ds.loads,m_ds.materials,m_ds.parameters,results.u_g);
+		else
+			save=m_ds.parameters.qmu_mass_flux_segments;
+			m_ds.parameters.qmu_mass_flux_segments=m_ds.parameters.qmu_mass_flux_segments{indx};
+			response=MassFlux(m_ds.elements,m_ds.nodes,m_ds.vertices,m_ds.loads,m_ds.materials,m_ds.parameters,results.u_g);
+			m_ds.parameters.qmu_mass_flux_segments=save;
+			clear save
+		end
 	else
 		error('qmuresponse error message: unsupported analysis type for mass_flux computation!');
 	end
 else
-	error(['qmuresponse error message: unknow descriptor ' descriptor]);
+	error(['qmuresponse error message: unknown descriptor ' descriptor]);
 end
+
