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};
|
---|
12 | nx=20; %numberof nodes in x direction
|
---|
13 | ny=20;
|
---|
14 | md=model;
|
---|
15 | md=squaremesh(md,L,L,nx,ny);
|
---|
16 | md=setmask(md,'',''); %ice sheet test
|
---|
17 |
|
---|
18 | % %Find elements at the corner and extract model
|
---|
19 | % posnodes=find((md.mesh.x==0 | md.mesh.x==max(md.mesh.x)) & (md.mesh.y==0 | md.mesh.y==max(md.mesh.y)));
|
---|
20 | % [a,b]=find(ismember(md.mesh.elements,posnodes));
|
---|
21 | % elements=ones(md.mesh.numberofelements,1);
|
---|
22 | % elements(a)=0;
|
---|
23 | % md=modelextract(md,elements);
|
---|
24 |
|
---|
25 | md=parameterize(md,'../Par/ISMIPA.par');
|
---|
26 | md=extrude(md,10,1);
|
---|
27 | md=setflowequation(md,'stokes','all');
|
---|
28 |
|
---|
29 | %Create dirichlet on the bed only
|
---|
30 | pos=find(md.mesh.vertexonbed);
|
---|
31 | md.diagnostic.spcvx(pos)=0;
|
---|
32 | md.diagnostic.spcvy(pos)=0;
|
---|
33 | md.diagnostic.spcvz(pos)=0;
|
---|
34 |
|
---|
35 | %Create MPCs to have periodic boundary conditions
|
---|
36 | %posx=find(md.mesh.x==0);
|
---|
37 | %posx2=find(md.mesh.x==max(md.mesh.x));
|
---|
38 | %posx=find(md.mesh.x==0 & md.mesh.y~=0 & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);
|
---|
39 | %posx2=find(md.mesh.x==max(md.mesh.x) & md.mesh.y~=0 & md.mesh.y~=max(md.mesh.y) & ~md.mesh.vertexonbed);
|
---|
40 |
|
---|
41 | %posy=find(md.mesh.y==0 & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed); %Don't take the same nodes two times
|
---|
42 | %posy2=find(md.mesh.y==max(md.mesh.y) & md.mesh.x~=0 & md.mesh.x~=max(md.mesh.x) & ~md.mesh.vertexonbed);
|
---|
43 |
|
---|
44 | %md.diagnostic.vertex_pairing=[posx,posx2;posy,posy2];
|
---|
45 |
|
---|
46 | %Compute the diagnostic
|
---|
47 | md.diagnostic.abstol=NaN;
|
---|
48 | md.diagnostic.reltol=NaN;
|
---|
49 | md.diagnostic.restol=1;
|
---|
50 | md.cluster=generic('name',oshostname(),'np',8);
|
---|
51 | md=solve(md,DiagnosticSolutionEnum);
|
---|
52 |
|
---|
53 | %Plot the results and save them
|
---|
54 | vx=(md.results.DiagnosticSolution.Vx);
|
---|
55 | vy=(md.results.DiagnosticSolution.Vy);
|
---|
56 | vz=(md.results.DiagnosticSolution.Vz);
|
---|
57 | pressure=(md.results.DiagnosticSolution.Pressure);
|
---|
58 | results{i}=md.results.DiagnosticSolution;
|
---|
59 | minvx(i)=min(vx(end-md.mesh.numberofvertices2d+1:end));
|
---|
60 | maxvx(i)=max(vx(end-md.mesh.numberofvertices2d+1:end));
|
---|
61 |
|
---|
62 | %Now plot vx, vy, vz and vx on a cross section
|
---|
63 | plotmodel(md,'data',vx,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',2)
|
---|
64 | if printingflag,
|
---|
65 | set(gcf,'Color','w')
|
---|
66 | printmodel(['ismipastokesvx' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
67 | system(['mv ismipastokesvx' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
68 | end
|
---|
69 | plotmodel(md,'data',vy,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',3)
|
---|
70 | if printingflag,
|
---|
71 | set(gcf,'Color','w')
|
---|
72 | printmodel(['ismipastokesvy' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
73 | system(['mv ismipastokesvy' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
74 | end
|
---|
75 | plotmodel(md,'data',vz,'layer#all',md.mesh.numberoflayers,'xlim',[0 L/10^3],'ylim',[0 L/10^3],'unit','km','figure',4)
|
---|
76 | if printingflag,
|
---|
77 | set(gcf,'Color','w')
|
---|
78 | printmodel(['ismipastokesvz' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
79 | system(['mv ismipastokesvz' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
80 | end
|
---|
81 |
|
---|
82 | if(L==5000),
|
---|
83 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP5000.exp','layer',md.mesh.numberoflayers,...
|
---|
84 | 'resolution',[10 10],'ylim',[10 18],'xlim',[0 5000],'title','','xlabel','')
|
---|
85 | elseif(L==10000),
|
---|
86 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP10000.exp','layer',md.mesh.numberoflayers,...
|
---|
87 | 'resolution',[10 10],'ylim',[10 30],'xlim',[0 10000],'title','','xlabel','')
|
---|
88 | elseif(L==20000),
|
---|
89 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP20000.exp','layer',md.mesh.numberoflayers,...
|
---|
90 | 'resolution',[10 10],'ylim',[0 50],'xlim',[0 20000],'title','','xlabel','')
|
---|
91 | elseif(L==40000),
|
---|
92 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP40000.exp','layer',md.mesh.numberoflayers,...
|
---|
93 | 'resolution',[10 10],'ylim',[0 80],'xlim',[0 40000],'title','','xlabel','')
|
---|
94 | elseif(L==80000),
|
---|
95 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP80000.exp','layer',md.mesh.numberoflayers,...
|
---|
96 | 'resolution',[10 10],'ylim',[0 100],'xlim',[0 80000],'title','','xlabel','')
|
---|
97 | elseif(L==160000),
|
---|
98 | plotmodel(md,'data',vx,'sectionvalue','../Exp/ISMIP160000.exp','layer',md.mesh.numberoflayers,...
|
---|
99 | 'resolution',[10 10],'ylim',[0 120],'xlim',[0 160000],'title','','xlabel','')
|
---|
100 | end
|
---|
101 | if printingflag,
|
---|
102 | set(gcf,'Color','w')
|
---|
103 | printmodel(['ismipastokesvxsec' num2str(L)],'png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
104 | system(['mv ismipastokesvxsec' num2str(L) '.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
105 | end
|
---|
106 | end
|
---|
107 |
|
---|
108 | %Now plot the min and max values of vx for each size of the square
|
---|
109 | plot([5 10 20 40 80 160],minvx);ylim([0 18])
|
---|
110 | if printingflag,
|
---|
111 | set(gcf,'Color','w')
|
---|
112 | printmodel('ismipastokesminvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
113 | system(['mv ismipastokesminvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
114 | end
|
---|
115 | plot([5 10 20 40 80 160],maxvx);ylim([0 120])
|
---|
116 | if printingflag,
|
---|
117 | set(gcf,'Color','w')
|
---|
118 | printmodel('ismipastokesmaxvx','png','margin','on','marginsize',25,'frame','off','resolution',1.5,'hardcopy','off');
|
---|
119 | system(['mv ismipastokesmaxvx.png ' ISSM_DIR '/website/doc_pdf/validation/Images/ISMIP/TestA ']);
|
---|
120 | end
|
---|
121 | %Fields and tolerances to track changes
|
---|
122 | field_names ={...
|
---|
123 | 'Vx5km','Vy5km','Vz5km',...
|
---|
124 | 'Vx10km','Vy10km','Vz10km',...
|
---|
125 | 'Vx20km','Vy20km','Vz20km',...
|
---|
126 | 'Vx40km','Vy40km','Vz40km',...
|
---|
127 | 'Vx80km','Vy80km','Vz80km',...
|
---|
128 | 'Vx160km','Vy160km','Vz160km'
|
---|
129 | }
|
---|
130 | field_tolerances={...
|
---|
131 | 1e-12,1e-12,1e-12,...
|
---|
132 | 1e-12,1e-12,1e-12,...
|
---|
133 | 1e-12,1e-11,1e-12,...
|
---|
134 | 1e-12,1e-11,1e-12,...
|
---|
135 | 1e-12,1e-11,1e-12,...
|
---|
136 | 1e-12,1e-11,1e-12,...
|
---|
137 | };
|
---|
138 | field_values={};
|
---|
139 | for i=1:6,
|
---|
140 | result=results{i};
|
---|
141 | field_values={field_values{:},...
|
---|
142 | (result.Vx),...
|
---|
143 | (result.Vy),...
|
---|
144 | (result.Vz),...
|
---|
145 | };
|
---|
146 | end
|
---|