1 | %This test is a test from the ISMP-HOM Intercomparison project
|
---|
2 | %Pattyn and Payne 2006
|
---|
3 | printingflag=false;
|
---|
4 |
|
---|
5 | L_list={5000,10000,20000,40000,80000,160000};
|
---|
6 | results={};
|
---|
7 | minvx=[];
|
---|
8 | maxvx=[];
|
---|
9 |
|
---|
10 | for i=1:length(L_list),
|
---|
11 | L=L_list{i}; %in m (3 times the desired lenght for BC problems)
|
---|
12 | nx=30; %number of nodes in x direction
|
---|
13 | ny=30;
|
---|
14 | md=model;
|
---|
15 | md=squaremesh(md,L,L,nx,ny);
|
---|
16 | md=setmask(md,'',''); %ice sheet test
|
---|
17 | md=parameterize(md,'../Par/ISMIPC.par');
|
---|
18 | md=extrude(md,10,1);
|
---|
19 |
|
---|
20 | md=setflowequation(md,'pattyn','all');
|
---|
21 |
|
---|
22 | %Create MPCs to have periodic boundary conditions
|
---|
23 | md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
|
---|
24 | md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
|
---|
25 | md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
|
---|
26 |
|
---|
27 | posx=find(md.mesh.x==0 & md.mesh.y~=0 & md.mesh.y~=L);
|
---|
28 | posx2=find(md.mesh.x==L & md.mesh.y~=0 & md.mesh.y~=L);
|
---|
29 |
|
---|
30 | posy=find(md.mesh.y==0 & md.mesh.x~=0 & md.mesh.x~=L); %Don't take the same nodes two times
|
---|
31 | posy2=find(md.mesh.y==L & md.mesh.x~=0 & md.mesh.x~=L);
|
---|
32 |
|
---|
33 | md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
|
---|
34 |
|
---|
35 | %Add spc on the corners
|
---|
36 | pos=find((md.mesh.x==0 | md.mesh.x==L) & (md.mesh.y==0 | md.mesh.y==L) & md.mesh.vertexonbed);
|
---|
37 | md.diagnostic.spcvx(pos)=0;
|
---|
38 | md.diagnostic.spcvy(pos)=0;
|
---|
39 | if(L==5000),
|
---|
40 | md.diagnostic.spcvx(pos)=15.66;
|
---|
41 | md.diagnostic.spcvy(pos)=-0.1967;
|
---|
42 | elseif(L==10000),
|
---|
43 | md.diagnostic.spcvx(pos)=16.04;
|
---|
44 | md.diagnostic.spcvy(pos)=-0.1977;
|
---|
45 | elseif(L==20000),
|
---|
46 | md.diagnostic.spcvx(pos)=16.53;
|
---|
47 | md.diagnostic.spcvy(pos)=-1.27;
|
---|
48 | elseif(L==40000),
|
---|
49 | md.diagnostic.spcvx(pos)=17.23;
|
---|
50 | md.diagnostic.spcvy(pos)=-3.17;
|
---|
51 | elseif(L==80000),
|
---|
52 | md.diagnostic.spcvx(pos)=16.68;
|
---|
53 | md.diagnostic.spcvy(pos)=-2.69;
|
---|
54 | elseif(L==160000),
|
---|
55 | md.diagnostic.spcvx(pos)=16.03;
|
---|
56 | md.diagnostic.spcvy(pos)=-1.27;
|
---|
57 | end
|
---|
58 |
|
---|
59 | %Spc the bed at zero for vz
|
---|
60 | pos=find(md.mesh.vertexonbed);
|
---|
61 | md.diagnostic.spcvz(pos)=0;
|
---|
62 |
|
---|
63 | %Compute the diagnostic
|
---|
64 | md.cluster=generic('name',oshostname(),'np',8);
|
---|
65 | md=solve(md,DiagnosticSolutionEnum);
|
---|
66 |
|
---|
67 | %Plot the results and save them
|
---|
68 | vx=(md.results.DiagnosticSolution.Vx);
|
---|
69 | vy=(md.results.DiagnosticSolution.Vy);
|
---|
70 | vz=(md.results.DiagnosticSolution.Vz);
|
---|
71 | results{i}=md.results.DiagnosticSolution;
|
---|
72 | minvx(i)=min(vx(end-md.mesh.numberofvertices2d+1:end));
|
---|
73 | maxvx(i)=max(vx(end-md.mesh.numberofvertices2d+1:end));
|
---|
74 |
|
---|
75 | %Now plot vx, vy, vz and vx on a cross section
|
---|
76 | plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2)
|
---|
77 | if printingflag,
|
---|
78 | set(gcf,'Color','w')
|
---|
79 | printmodel(['ismipcpattynvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
80 | system(['mv ismipcpattynvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
81 | end
|
---|
82 | plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3)
|
---|
83 | if printingflag,
|
---|
84 | set(gcf,'Color','w')
|
---|
85 | printmodel(['ismipcpattynvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
86 | system(['mv ismipcpattynvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
87 | end
|
---|
88 | plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4)
|
---|
89 | if printingflag,
|
---|
90 | set(gcf,'Color','w')
|
---|
91 | printmodel(['ismipcpattynvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
92 | system(['mv ismipcpattynvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
93 | end
|
---|
94 |
|
---|
95 | if(L==5000),
|
---|
96 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
|
---|
97 | 'resolution',[10 10],'ylim',[0 20],'xlim',[0 5000],'title','','xlabel','','figure',5)
|
---|
98 | elseif(L==10000),
|
---|
99 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
|
---|
100 | 'resolution',[10 10],'ylim',[13 18],'xlim',[0 10000],'title','','xlabel','')
|
---|
101 | elseif(L==20000),
|
---|
102 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
|
---|
103 | 'resolution',[10 10],'ylim',[14 22],'xlim',[0 20000],'title','','xlabel','')
|
---|
104 | elseif(L==40000),
|
---|
105 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
|
---|
106 | 'resolution',[10 10],'ylim',[10 40],'xlim',[0 40000],'title','','xlabel','')
|
---|
107 | elseif(L==80000),
|
---|
108 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
|
---|
109 | 'resolution',[10 10],'ylim',[0 80],'xlim',[0 80000],'title','','xlabel','')
|
---|
110 | elseif(L==160000),
|
---|
111 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
|
---|
112 | 'resolution',[10 10],'ylim',[0 200],'xlim',[0 160000],'title','','xlabel','')
|
---|
113 | end
|
---|
114 | if printingflag,
|
---|
115 | set(gcf,'Color','w')
|
---|
116 | printmodel(['ismipcpattynvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
117 | system(['mv ismipcpattynvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
118 | end
|
---|
119 | end
|
---|
120 |
|
---|
121 | %Now plot the min and max values of vx for each size of the square
|
---|
122 | plot([5 10 20 40 80 160],minvx);ylim([4 18]);xlim([0 160])
|
---|
123 | if printingflag,
|
---|
124 | set(gcf,'Color','w')
|
---|
125 | printmodel('ismipcpattynminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
126 | system(['mv ismipcpattynminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
127 | end
|
---|
128 | plot([5 10 20 40 80 160],maxvx);ylim([0 200]); xlim([0 160])
|
---|
129 | if printingflag,
|
---|
130 | set(gcf,'Color','w')
|
---|
131 | printmodel('ismipcpattynmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
132 | system(['mv ismipcpattynmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestC ']);
|
---|
133 | end
|
---|
134 | %Fields and tolerances to track changes
|
---|
135 | field_names ={...
|
---|
136 | 'Vx5km','Vy5km','Vz5km',...
|
---|
137 | 'Vx10km','Vy10km','Vz10km',...
|
---|
138 | 'Vx20km','Vy20km','Vz20km',...
|
---|
139 | 'Vx40km','Vy40km','Vz40km',...
|
---|
140 | 'Vx80km','Vy80km','Vz80km',...
|
---|
141 | 'Vx160km','Vy160km','Vz160km'
|
---|
142 | };
|
---|
143 | field_tolerances={...
|
---|
144 | 1e-08,1e-07,1e-07,...
|
---|
145 | 1e-09,1e-07,1e-08,...
|
---|
146 | 1e-09,1e-09,1e-07,...
|
---|
147 | 1e-09,1e-09,1e-08,...
|
---|
148 | 1e-09,1e-08,1e-08,...
|
---|
149 | 1e-09,1e-08,1e-08,...
|
---|
150 | };
|
---|
151 | field_values={};
|
---|
152 | for i=1:6,
|
---|
153 | result=results{i};
|
---|
154 | field_values={field_values{:},...
|
---|
155 | (result.Vx),...
|
---|
156 | (result.Vy),...
|
---|
157 | (result.Vz),...
|
---|
158 | };
|
---|
159 | end
|
---|