Index: issm/trunk/test/NightlyRun/test237.m
===================================================================
--- issm/trunk/test/NightlyRun/test237.m	(revision 19105)
+++ issm/trunk/test/NightlyRun/test237.m	(revision 20500)
@@ -7,57 +7,7 @@
 
 % Use of ispdd methods
-md.surfaceforcings = SMBpdd();
-md.surfaceforcings.isdelta18o=0;
-md.surfaceforcings.ismungsm=1;
-
-if md.surfaceforcings.isdelta18o==0 & md.surfaceforcings.ismungsm==0
-    md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
-    md.surfaceforcings.monthlytemperatures=273*ones(md.mesh.numberofvertices,1);
-end
-    
-
-% Add temperature, precipitation and delta18o needed to measure the surface mass balance
-% % creating delta18o
-% load '../Data/delta18o.data'
-% md.surfaceforcings.delta18o=delta18o;
-% % creating delta18oSurface
-% md.surfaceforcings.delta18o_surface(1,1:(length(delta18o))) = 0;
-% md.surfaceforcings.delta18o_surface(2,:) = delta18o(2,:);
-
-% creating Present day and lgm temperatures
-% Same temperature over the all region:
-tmonth(1:12)=238.15+20.;
-for imonth=0:11
-    md.surfaceforcings.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
-    md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
-    % Time for the last line:
-    md.surfaceforcings.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-end
-
-% creating initialization and spc temperatures initialization and spc
-md.thermal.spctemperature=mean(md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
-md.thermal.spctemperature=repmat(md.thermal.spctemperature,1,md.timestepping.final_time/md.timestepping.time_step);
-itemp=0:md.timestepping.time_step:md.timestepping.final_time-md.timestepping.time_step;
-md.thermal.spctemperature(md.mesh.numberofvertices+1,:)=itemp;
-
-md.initialization.temperature=md.surfaceforcings.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
-
-% creating precipitation
-for imonth=0:11
-    md.surfaceforcings.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
-    md.surfaceforcings.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
-    % Time for the last line:
-    md.surfaceforcings.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-    md.surfaceforcings.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
-end
-
-md.surfaceforcings.Pfac(1,1:md.timestepping.final_time)=0.5;
-md.surfaceforcings.Tdiff(1,1:md.timestepping.final_time)=0.5;
-md.surfaceforcings.sealev(1,1:md.timestepping.final_time)=0.5;
-% Year of each data point
-md.surfaceforcings.Pfac(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
-md.surfaceforcings.Tdiff(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
-md.surfaceforcings.sealev(2,1:md.timestepping.final_time)=1:1:md.timestepping.final_time;
+md.smb = SMBpdd();
+md.smb.isdelta18o=0;
+md.smb.ismungsm=1;
 
 % time steps and resolution
@@ -66,6 +16,45 @@
 md.timestepping.final_time=60;
 
+% creating Present day and lgm temperatures
+% Same temperature over the all region:
+tmonth(1:12)=238.15+20.;
+for imonth=0:11
+    md.smb.temperatures_presentday(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1);
+    md.smb.temperatures_lgm(1:md.mesh.numberofvertices,imonth+1)=tmonth(imonth+1)-20.;
+    % Time for the last line:
+    md.smb.temperatures_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.temperatures_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+
+% creating initialization and spc temperatures initialization and spc
+md.thermal.spctemperature=mean(md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1:12),2); %-10*ones(md.mesh.numberofvertices,1);
+md.thermal.spctemperature=repmat(md.thermal.spctemperature,1,md.timestepping.final_time/md.timestepping.time_step);
+itemp=0:md.timestepping.time_step:md.timestepping.final_time-md.timestepping.time_step;
+md.thermal.spctemperature(md.mesh.numberofvertices+1,:)=itemp;
+
+md.initialization.temperature=md.smb.temperatures_lgm(1:md.mesh.numberofvertices,1); %*ones(md.mesh.numberofvertices,1);
+md.smb = initialize(md.smb,md);
+
+% creating precipitation
+for imonth=0:11
+    md.smb.precipitations_presentday(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    md.smb.precipitations_lgm(1:md.mesh.numberofvertices,imonth+1)=-0.4*10^(-6)*md.mesh.y+0.5;
+    % Time for the last line:
+    md.smb.precipitations_presentday(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+    md.smb.precipitations_lgm(md.mesh.numberofvertices+1,imonth+1)=((imonth+1)/12);
+end
+
+for iint=1:(md.timestepping.final_time/md.timestepping.time_step)+1
+    md.smb.Pfac(1,iint)=0.15*iint;
+    md.smb.Tdiff(1,iint)=0.15*iint;
+    md.smb.sealev(1,iint)=0.15*iint;
+    % Year of each data point
+    md.smb.Pfac(2,iint)=(iint-1)*20;
+    md.smb.Tdiff(2,iint)=(iint-1)*20;
+    md.smb.sealev(2,iint)=(iint-1)*20;
+end
+
 %
-md.transient.requested_outputs={'default','SurfaceforcingsMonthlytemperatures'};
+md.transient.requested_outputs={'default','SmbMonthlytemperatures'};
 md=extrude(md,3,1);
 
@@ -75,11 +64,11 @@
 
 %Fields and tolerances to track changes
-field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1', ...
-						'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2', ...
-						'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3'};
+field_names     ={'Vx1','Vy1','Vz1','Vel1','Pressure1','Bed1','Surface1','Thickness1','Temperature1','BasalforcingsGroundediceMeltingRate1','SmbMonthlytemperatures1','SmbMassBalance1',...
+						'Vx2','Vy2','Vz2','Vel2','Pressure2','Bed2','Surface2','Thickness2','Temperature2','BasalforcingsGroundediceMeltingRate2','SmbMonthlytemperatures2','SmbMassBalance2',...
+						'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsGroundediceMeltingRate3','SmbMonthlytemperatures3','SmbMassBalance3'};
 field_tolerances={...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,...
-	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,...
-	1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8};
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-8,1e-13,1e-13,...
+	1e-13,1e-13,1e-13,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,1e-7,1e-13,1e-13,...
+	1e-13,1e-13,1e-08,1e-13,1e-13,1e-8,1e-8,1e-8,1e-13,5e-7,1e-13,1e-13};
 field_values={...
 	(md.results.TransientSolution(1).Vx),...
@@ -93,6 +82,6 @@
 	(md.results.TransientSolution(1).Temperature),...
 	(md.results.TransientSolution(1).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(1).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(1).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(1).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(1).SmbMassBalance),...
 	(md.results.TransientSolution(2).Vx),...
 	(md.results.TransientSolution(2).Vy),...
@@ -105,6 +94,6 @@
 	(md.results.TransientSolution(2).Temperature),...
 	(md.results.TransientSolution(2).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(2).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(2).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(2).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(2).SmbMassBalance),...
 	(md.results.TransientSolution(3).Vx),...
 	(md.results.TransientSolution(3).Vy),...
@@ -117,5 +106,5 @@
 	(md.results.TransientSolution(3).Temperature),...
 	(md.results.TransientSolution(3).BasalforcingsGroundediceMeltingRate),...
-	(md.results.TransientSolution(3).SurfaceforcingsMonthlytemperatures),...
-	(md.results.TransientSolution(3).SurfaceforcingsMassBalance),...
+	(md.results.TransientSolution(3).SmbMonthlytemperatures),...
+	(md.results.TransientSolution(3).SmbMassBalance),...
 	};
