Index: /issm/trunk/test/NightlyRun/test1105.m
===================================================================
--- /issm/trunk/test/NightlyRun/test1105.m	(revision 5515)
+++ /issm/trunk/test/NightlyRun/test1105.m	(revision 5516)
@@ -1,30 +1,61 @@
 %This test is a test from the ISMP-HOM Intercomparison project
 %Pattyn and Payne 2006
+printingflag=true;
 
 L_list={5000,10000,20000,40000,80000,160000};
 results={};
+minvx=[];
+maxvx=[];
 
 for i=1:length(L_list),
-	L=3*L_list{i};  %in m (3 times the desired lenght for BC problems)  
-	nx=60; %number of nodes in x direction
-	ny=60;
+	L=L_list{i};  %in m (3 times the desired lenght for BC problems)  
+	nx=30; %number of nodes in x direction
+	ny=30;
 	md=model;
 	md=squaremesh(md,L,L,nx,ny);
 	md=geography(md,'',''); %ice sheet test
 	md=parameterize(md,'../Par/ISMIPC.par');
-	md=extrude(md,6,1);
+	md=extrude(md,10,1);
+	md.verbose=4;
 
 	md=setelementstype(md,'pattyn','all'); 
 
 	%Create MPCs to have periodic boundary conditions
-	%md.spcvelocity=zeros(md.numberofgrids,6);
+	md.spcvelocity=zeros(md.numberofgrids,6);
 
-	%posx=find(md.x==0);
-	%posx2=find(md.x==L);
+	posx=find(md.x==0 & md.y~=0 & md.y~=L);
+	posx2=find(md.x==L & md.y~=0 & md.y~=L);
 
-	%posy=find(md.y==0 & md.x~=0 & md.x~=L); %Don't take the same grids two times
-	%posy2=find(md.y==L & md.x~=0 & md.x~=L);
+	posy=find(md.y==0 & md.x~=0 & md.x~=L); %Don't take the same grids two times
+	posy2=find(md.y==L & md.x~=0 & md.x~=L);
 
-	%md.penalties=[posx,posx2;posy,posy2];
+	md.penalties=[posx,posx2;posy,posy2];
+
+	%Add spc on the corners
+	pos=find((md.x==0 | md.x==L) & (md.y==0 | md.y==L) & md.gridonbed);
+	md.spcvelocity(pos,1:2)=1;
+	if(L==5000),
+		md.spcvelocity(pos,4)=15.66;
+		md.spcvelocity(pos,5)=-0.1967;
+	elseif(L==10000),
+		md.spcvelocity(pos,4)=16.04;
+		md.spcvelocity(pos,5)=-0.1977;
+	elseif(L==20000),
+		md.spcvelocity(pos,4)=16.53;
+		md.spcvelocity(pos,5)=-1.27;
+	elseif(L==40000),
+		md.spcvelocity(pos,4)=17.23;
+		md.spcvelocity(pos,5)=-3.17;
+	elseif(L==80000),
+		md.spcvelocity(pos,4)=16.68;
+		md.spcvelocity(pos,5)=-2.69;
+	elseif(L==160000),
+		md.spcvelocity(pos,4)=16.03;
+		md.spcvelocity(pos,5)=-1.27;
+	end
+	
+	%Spc the bed at zero for vz
+	pos=find(md.gridonbed);
+	md.spcvelocity(pos,3)=1;
 
 	%Compute the diagnostic
@@ -36,8 +67,66 @@
 	vz=PatchToVec(md.results.DiagnosticSolution.Vz);
 	results{i}=md.results.DiagnosticSolution;
+	minvx(i)=min(vx(end-md.numberofgrids2d+1:end));
+	maxvx(i)=max(vx(end-md.numberofgrids2d+1:end));
 
-	plotmodel(md,'data',vx,'data',vy,'data',vz,'layer#all',md.numlayers)
+	%Now plot vx, vy, vz and vx on a cross section
+	plotmodel(md,'data',vx,'layer#all',md.numlayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2)
+	if printingflag, 
+		set(gcf,'Color','w')
+		printmodel(['ismipcpattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+		system(['mv ismipcpattynvx' num2str(L) '.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+	end
+	plotmodel(md,'data',vy,'layer#all',md.numlayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3)
+	if printingflag, 
+		set(gcf,'Color','w')
+		printmodel(['ismipcpattynvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+		system(['mv ismipcpattynvy' num2str(L) '.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+	end
+	plotmodel(md,'data',vz,'layer#all',md.numlayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4)
+	if printingflag, 
+		set(gcf,'Color','w')
+		printmodel(['ismipcpattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+		system(['mv ismipcpattynvz' num2str(L) '.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+	end
+
+	if(L==5000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',5)
+	elseif(L==10000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[13 18],'xlim',[0 10000],'title','','xlabel','')
+	elseif(L==20000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[14 22],'xlim',[0 20000],'title','','xlabel','')
+	elseif(L==40000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[10 40],'xlim',[0 40000],'title','','xlabel','')
+	elseif(L==80000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[0 80],'xlim',[0 80000],'title','','xlabel','')
+	elseif(L==160000),
+		plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.numlayers,...
+			'resolution',[10 10],'ylim',[0 200],'xlim',[0 160000],'title','','xlabel','')
+	end
+	if printingflag, 
+		set(gcf,'Color','w')
+		printmodel(['ismipcpattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+		system(['mv ismipcpattynvxsec' num2str(L) '.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+	end
 end
 
+%Now plot the min and max values of vx for each size of the square
+plot([5 10 20 40 80 160],minvx);ylim([4 18])
+if printingflag, 
+	set(gcf,'Color','w')
+	printmodel('ismipcpattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+	system(['mv ismipcpattynminvx.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+end
+plot([5 10 20 40 80 160],maxvx);ylim([0 200])
+if printingflag, 
+	set(gcf,'Color','w')
+	printmodel('ismipcpattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
+	system(['mv ismipcpattynmaxvx.png ' ISSM_DIR '/../website/doc_pdf/validation/Images/ISMIP/TestC ']);
+end
 %Fields and tolerances to track changes
 field_names     ={...
