Index: /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 22483)
+++ /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 22484)
@@ -20,6 +20,8 @@
 	/*Output*/
 	IssmDouble *spcvector  = NULL;
+	IssmDouble *spcvectorstatic  = NULL;
 	IssmDouble* times=NULL;
 	IssmDouble* values=NULL;
+	IssmDouble* issurface = NULL;
 
 	/*Fetch parameters: */
@@ -32,13 +34,7 @@
 
 	/*Fetch data: */
+	iomodel->FetchData(&issurface,&M,&N,"md.mesh.vertexonsurface"); _assert_(N>0); _assert_(M==iomodel->numberofvertices);
 	iomodel->FetchData(&spcvector,&M,&N,"md.thermal.spctemperature");
-
-	/*Convert spcs from temperatures to enthalpy*/
-	_assert_(N>0); _assert_(M>=iomodel->numberofvertices);
-	for(int i=0;i<iomodel->numberofvertices;i++){
-		for(int j=0;j<N;j++){
-			spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature);
-		}
-	}
+	iomodel->FetchData(&spcvectorstatic,&M,&N,"md.thermal.spctemperature");
 
 	/*Specific case for PDD, we want the constaints to be updated by the PDD scheme itself*/
@@ -51,6 +47,27 @@
 	}
 
+	/*Convert spcs from temperatures to enthalpy*/
+	_assert_(N>0); _assert_(M>=iomodel->numberofvertices);
+	for(int i=0;i<iomodel->numberofvertices;i++){
+		for(int j=0;j<N;j++){
+			if (isdynamic){
+				if (issurface[i]==1){
+					spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature);
+					spcvectorstatic[i*N+j] = nan("");
+				}
+				else{
+					spcvector[i*N+j] = nan("");
+					spcvectorstatic[i*N+j] = heatcapacity*(spcvectorstatic[i*N+j]-referencetemperature);
+				}
+			}
+			else{
+				spcvector[i*N+j] = heatcapacity*(spcvector[i*N+j]-referencetemperature);
+			}
+		}
+	}
+
 	if(isdynamic){
-		IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,M,N,EnthalpyAnalysisEnum,finiteelement);
+		IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,iomodel->numberofvertices,1,EnthalpyAnalysisEnum,finiteelement);
+		IoModelToConstraintsx(constraints,iomodel,spcvectorstatic,M,N,EnthalpyAnalysisEnum,finiteelement);
 	}
 	else{
@@ -60,4 +77,6 @@
 	/*Free ressources:*/
 	iomodel->DeleteData(spcvector,"md.thermal.spctemperature");
+	iomodel->DeleteData(spcvectorstatic,"md.thermal.spctemperature");
+	iomodel->DeleteData(issurface,"md.mesh.vertexonsurface");
 	xDelete<IssmDouble>(times);
 	xDelete<IssmDouble>(values);
Index: /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 22483)
+++ /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 22484)
@@ -9,7 +9,13 @@
 
 	/*Intermediary*/
+	int        M,N;
 	int finiteelement;
 	iomodel->FindConstant(&finiteelement,"md.thermal.fe");
 	_assert_(finiteelement==P1Enum); 
+
+	/*Output*/
+	IssmDouble *spcvector  = NULL;
+	IssmDouble *spcvectorstatic  = NULL;
+	IssmDouble *issurface = NULL;
 
 	/*Only 3d mesh supported*/
@@ -34,10 +40,32 @@
 	}
 
+	/*Fetch data: */
+	iomodel->FetchData(&issurface,&M,&N,"md.mesh.vertexonsurface"); _assert_(N>0); _assert_(M==iomodel->numberofvertices);
+	iomodel->FetchData(&spcvector,&M,&N,"md.thermal.spctemperature");
+	iomodel->FetchData(&spcvectorstatic,&M,&N,"md.thermal.spctemperature");
+
+	/*Convert spcs from temperatures to enthalpy*/
+	_assert_(N>0); _assert_(M>=iomodel->numberofvertices);
+	for(int i=0;i<iomodel->numberofvertices;i++){
+		for(int j=0;j<N;j++){
+			if (isdynamic){
+				if (issurface[i]==1)spcvectorstatic[i*N+j] = nan("");
+				else spcvector[i*N+j] = nan("");
+			}
+		}
+	}
+
 	if(isdynamic){
-		IoModelToDynamicConstraintsx(constraints,iomodel,"md.thermal.spctemperature",ThermalAnalysisEnum,finiteelement);
+		IoModelToDynamicConstraintsx(constraints,iomodel,spcvector,iomodel->numberofvertices,1,ThermalAnalysisEnum,finiteelement);
+		IoModelToConstraintsx(constraints,iomodel,spcvectorstatic,M,N,ThermalAnalysisEnum,finiteelement);
 	}
 	else{
-		IoModelToConstraintsx(constraints,iomodel,"md.thermal.spctemperature",ThermalAnalysisEnum,finiteelement);
-	}
+		IoModelToConstraintsx(constraints,iomodel,spcvector,M,N,ThermalAnalysisEnum,finiteelement);
+	}
+
+	/*Free ressources:*/
+	iomodel->DeleteData(spcvector,"md.thermal.spctemperature");
+	iomodel->DeleteData(spcvectorstatic,"md.thermal.spctemperature");
+	iomodel->DeleteData(issurface,"md.mesh.vertexonsurface");
 
 }/*}}}*/
