Index: /issm/trunk/src/c/objects/Beam.cpp
===================================================================
--- /issm/trunk/src/c/objects/Beam.cpp	(revision 3040)
+++ /issm/trunk/src/c/objects/Beam.cpp	(revision 3041)
@@ -666,5 +666,5 @@
 #undef __FUNCT__ 
 #define __FUNCT__ "Beam::Misfit"
-double Beam::Misfit(void*,int,int ){
+double Beam::Misfit(void*,int,int,int){
 	throw ErrorException(__FUNCT__," not supported yet!");
 }
Index: /issm/trunk/src/c/objects/Beam.h
===================================================================
--- /issm/trunk/src/c/objects/Beam.h	(revision 3040)
+++ /issm/trunk/src/c/objects/Beam.h	(revision 3041)
@@ -87,5 +87,5 @@
 		void  GradjDrag(_p_Vec*, void*, int,int );
 		void  GradjB(_p_Vec*, void*, int,int );
-		double Misfit(void*,int,int );
+		double Misfit(void*,int,int,int);
 		void  GetNodalFunctions(double* l1l2, double gauss_coord);
 		void  GetParameterValue(double* pvalue, double* value_list,double gauss_coord);
Index: /issm/trunk/src/c/objects/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Element.h	(revision 3040)
+++ /issm/trunk/src/c/objects/Element.h	(revision 3041)
@@ -38,5 +38,5 @@
 		virtual void  GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type)=0;
 		virtual void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type)=0;
-		virtual double Misfit(void* inputs,int analysis_type,int sub_analysis_type)=0;
+		virtual double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real)=0;
 		virtual void  ComputePressure(Vec p_g)=0;
 		virtual double MassFlux(double* segment,double* ug)=0;
Index: /issm/trunk/src/c/objects/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penta.cpp	(revision 3040)
+++ /issm/trunk/src/c/objects/Penta.cpp	(revision 3041)
@@ -3926,5 +3926,5 @@
 #undef __FUNCT__ 
 #define __FUNCT__ "Penta::Misfit"
-double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type){
+double Penta::Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real){
 
 	double J;
@@ -3945,5 +3945,5 @@
 		 * and compute Misfit*/
 		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
-		J=tria->Misfit(inputs,analysis_type,sub_analysis_type);
+		J=tria->Misfit(inputs,analysis_type,sub_analysis_type,real);
 		delete tria;
 		return J;
@@ -3952,5 +3952,5 @@
 
 		tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
-		J=tria->Misfit(inputs,analysis_type,sub_analysis_type);
+		J=tria->Misfit(inputs,analysis_type,sub_analysis_type,real);
 		delete tria;
 		return J;
Index: /issm/trunk/src/c/objects/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Penta.h	(revision 3040)
+++ /issm/trunk/src/c/objects/Penta.h	(revision 3041)
@@ -88,5 +88,5 @@
 		void  GradjDrag(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
 		void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
-		double Misfit(void* inputs,int analysis_type,int sub_analysis_type);
+		double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real);
 		
 		void          GetThicknessList(double* thickness_list);
Index: /issm/trunk/src/c/objects/Sing.cpp
===================================================================
--- /issm/trunk/src/c/objects/Sing.cpp	(revision 3040)
+++ /issm/trunk/src/c/objects/Sing.cpp	(revision 3041)
@@ -515,5 +515,5 @@
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::Misfit"
-double Sing::Misfit(void*, int,int){
+double Sing::Misfit(void*, int,int,int){
 	throw ErrorException(__FUNCT__," not supported yet!");
 }
Index: /issm/trunk/src/c/objects/Sing.h
===================================================================
--- /issm/trunk/src/c/objects/Sing.h	(revision 3040)
+++ /issm/trunk/src/c/objects/Sing.h	(revision 3041)
@@ -82,5 +82,5 @@
 		void  GradjDrag(_p_Vec*, void*, int,int);
 		void  GradjB(_p_Vec*, void*, int,int);
-		double Misfit(void*,int,int);
+		double Misfit(void*,int,int,int);
 		double MassFlux(double* segment,double* ug);
 
Index: /issm/trunk/src/c/objects/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Tria.cpp	(revision 3040)
+++ /issm/trunk/src/c/objects/Tria.cpp	(revision 3041)
@@ -4322,5 +4322,5 @@
 #undef __FUNCT__ 
 #define __FUNCT__ "Tria::Misfit"
-double Tria::Misfit(void* vinputs,int analysis_type,int sub_analysis_type){
+double Tria::Misfit(void* vinputs,int analysis_type,int sub_analysis_type,int real){
 
 	int i;
@@ -4456,34 +4456,36 @@
 
 		/*Add dampening terms to misfit*/
-		if (strcmp(numpar->control_type,"drag")==0){
-			if (!shelf){
-
+		if(!real){
+			if (strcmp(numpar->control_type,"drag")==0){
+				if (!shelf){
+
+					//noise dampening
+					GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
+					Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight;
+
+				}
+			}
+			else if (strcmp(numpar->control_type,"B")==0){
+				if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){
+					throw ErrorException(__FUNCT__,"parameter B not found in input");
+				}
 				//noise dampening
-				GetParameterDerivativeValue(&dk[0], &k[0],&xyz_list[0][0], gauss_l1l2l3);
-				Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight;
-
+				GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3);
+				Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
+
+				//min dampening
+				GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3);
+				if(B_gauss<numpar->cm_mindmp_value){ 
+					Jelem+=numpar->cm_mindmp_slope*B_gauss*Jdet*gauss_weight;
+				}
+
+				//max dampening
+				if(B_gauss>numpar->cm_maxdmp_value){ 
+					Jelem+=numpar->cm_maxdmp_slope*B_gauss*Jdet*gauss_weight;
+				}
 			}
-		}
-		else if (strcmp(numpar->control_type,"B")==0){
-			if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){
-				throw ErrorException(__FUNCT__,"parameter B not found in input");
+			else{
+				throw ErrorException(__FUNCT__,exprintf("%s%s","unsupported control type: ",numpar->control_type));
 			}
-			//noise dampening
-			GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3);
-			Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
-
-			//min dampening
-			GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3);
-			if(B_gauss<numpar->cm_mindmp_value){ 
-				Jelem+=numpar->cm_mindmp_slope*B_gauss*Jdet*gauss_weight;
-			}
-
-			//max dampening
-			if(B_gauss>numpar->cm_maxdmp_value){ 
-				Jelem+=numpar->cm_maxdmp_slope*B_gauss*Jdet*gauss_weight;
-			}
-		}
-		else{
-			throw ErrorException(__FUNCT__,exprintf("%s%s","unsupported control type: ",numpar->control_type));
 		}
 
@@ -4511,4 +4513,5 @@
 		}
 		else throw ErrorException(__FUNCT__,exprintf("%s%i%s","fit type",fit," not supported yet!"));
+			
 
 	}
@@ -4518,5 +4521,5 @@
 	xfree((void**)&third_gauss_area_coord);
 	xfree((void**)&gauss_weights);
-
+		
 	/*Return: */
 	return Jelem;
Index: /issm/trunk/src/c/objects/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Tria.h	(revision 3040)
+++ /issm/trunk/src/c/objects/Tria.h	(revision 3041)
@@ -99,5 +99,5 @@
 		void  SurfaceNormal(double* surface_normal, double xyz_list[3][3]);
 		void  GradjB(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type);
-		double Misfit(void* inputs,int analysis_type,int sub_analysis_type);
+		double Misfit(void* inputs,int analysis_type,int sub_analysis_type,int real);
 
 		void  CreatePVectorDiagnosticHoriz(Vec pg,void* inputs,int analysis_type,int sub_analysis_type);
