Changeset 14045
- Timestamp:
- 11/28/12 15:38:57 (12 years ago)
- Location:
- issm/workshop/2012/Talks/09_PIG_Application
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/workshop/2012/Talks/09_PIG_Application/Exp_Par/Pig.par ¶
r14029 r14045 1 % Parameters to change/Try 2 friction_coefficient = 10; % default [10] 3 Temp_change = 0; % default [0 K] 4 1 5 %Name and hemisphere 2 6 md.miscellaneous.name='PIG'; … … 49 53 50 54 disp(' Interpolating temperatures'); 51 md.initialization.temperature=InterpFromGridToMesh(x1,y1,temp,md.mesh.x,md.mesh.y,0)+273.15 ;55 md.initialization.temperature=InterpFromGridToMesh(x1,y1,temp,md.mesh.x,md.mesh.y,0)+273.15+Temp_change; 52 56 53 57 disp(' Interpolating surface mass balance'); … … 56 60 57 61 disp(' Construct basal friction parameters'); 58 md.friction.coefficient= 10*ones(md.mesh.numberofvertices,1);62 md.friction.coefficient=friction_coefficient*ones(md.mesh.numberofvertices,1); 59 63 pos=find(md.mask.vertexonfloatingice); 60 64 md.friction.coefficient(pos)=0; %no friction applied on floating ice -
TabularUnified issm/workshop/2012/Talks/09_PIG_Application/runme.m ¶
r14029 r14045 1 steps=[1 2 3 4]; 2 3 %SeaRISe dataset for Antarctica. Can be downloaded at: 4 %http://websrv.cs.umt.edu/isis/index.php/Present_Day_Antarctica 5 1 % MacAyeal Steps 2 steps=[1 2 3 4 5]; 3 4 % Blatter-Pattyn Steps 5 % steps=[6 7]; 6 7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 % SeaRISe dataset for Antarctica. Can be downloaded at: 9 % http://websrv.cs.umt.edu/isis/index.php/Present_Day_Antarctica 6 10 searise='./Data/Antarctica_5km_withshelves_v0.75.nc'; 7 11 8 % Rignot et al, 2011. NSIDC available velocities (at http://nsidc.org/data/nsidc-0484.html)12 % Rignot et al, 2011. NSIDC available velocities (at http://nsidc.org/data/nsidc-0484.html) 9 13 nsidc_vel='./Data/Antarctica_ice_velocity.nc'; 10 14 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 % Create Mesh 11 17 if any(steps==1) 12 18 disp(' Step 1: Mesh creation'); 13 19 14 15 %Generate initial uniform mesh (resolution = 10000 m) 20 % Generate an initial uniform mesh (resolution = 10000 m) 16 21 md=bamg(model,'domain','Exp_Par/DomainOutline.exp','hmax',10000,'MaxCornerAngle',1); 17 22 18 23 % Get velocities (Note: You can use ncdisp('file') to see an ncdump) 19 24 xmin = ncreadatt(nsidc_vel,'/','xmin'); 20 xmin = strtrim(xmin); % this is a string, and we need to recover the double value21 xmin = xmin(1:end-2); % get rid of the unit22 xmin = str2num(xmin); % convert to double25 xmin = strtrim(xmin); % this is a string, and we need to recover the double value 26 xmin = xmin(1:end-2); % get rid of the unit 27 xmin = str2num(xmin); % convert to double 23 28 ymax = ncreadatt(nsidc_vel,'/','ymax'); ymax = strtrim(ymax); ymax = ymax(1:end-2); ymax = str2num(ymax); 24 29 nx = ncreadatt(nsidc_vel,'/','nx'); … … 30 35 y=(ymax-ny*spacing)+(0:1:ny)'*spacing; y=double(y); 31 36 32 % interpolate velocities onto coarse mesh37 % Interpolate velocities onto coarse mesh 33 38 vx_obs=InterpFromGridToMesh(x,y,flipud(vx'),md.mesh.x,md.mesh.y,0); 34 39 vy_obs=InterpFromGridToMesh(x,y,flipud(vy'),md.mesh.x,md.mesh.y,0); 35 40 vel_obs=sqrt(vx_obs.^2+vy_obs.^2); 36 41 37 % Adapt the mesh to minimize error in velocity interpolation42 % Adapt the mesh to minimize error in velocity interpolation 38 43 md=bamg(md,'hmax',400000,'hmin',5000,'gradation',1.7,'field',vel_obs,'err',8); 39 44 40 % convert x,y coordinates (Polar stereo) to lat/lon45 % Convert x,y coordinates (Polar stereo) to lat/lon 41 46 [md.mesh.lat,md.mesh.long]=xy2ll(md.mesh.x,md.mesh.y,+1,39,71); 42 47 48 % Save model 43 49 save ./Models/Pig.Mesh_generation md; 44 50 end 45 51 52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 53 % Masks 54 46 55 if any(steps==2) 56 47 57 disp(' Step 2: Mask (floating vs grounded)'); 48 58 md = loadmodel('./Models/Pig.Mesh_generation'); … … 63 73 md=setmask(md,elementoniceshelf,''); 64 74 75 % Save model 65 76 save ./Models/Pig.Mask md; 66 77 end 67 78 79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 80 % Parameterization 81 68 82 if any(steps==3) 83 69 84 disp(' Step 3: Parameterization'); 70 85 md = loadmodel('./Models/Pig.Mask'); 71 72 86 md = parameterize(md,'./Exp_Par/Pig.par'); 87 88 % Use a MacAyeal flow model 73 89 md = setflowequation(md,'macayeal','all'); 74 90 91 % Save model 75 92 save ./Models/Pig.Parameterization md; 76 93 end 94 95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 96 % Control Method on Friction Coefficient 77 97 if any(steps==4) 78 98 disp(' Step 4: Control method friction'); 79 99 md = loadmodel('./Models/Pig.Parameterization'); 80 100 81 % Control general101 % Control general 82 102 md.inversion.iscontrol=1; 83 103 md.inversion.nsteps=20; … … 86 106 md.verbose=verbose('solution',true,'control',true); 87 107 88 % Cost functions108 % Cost functions 89 109 md.inversion.cost_functions=[[103*ones(md.inversion.nsteps/2,1); 101*ones(md.inversion.nsteps/2,1)] 501*ones(md.inversion.nsteps,1)]; 90 110 md.inversion.cost_functions_coefficients=ones(md.mesh.numberofvertices,2); … … 92 112 md.inversion.cost_functions_coefficients(:,2)=8e-15; 93 113 94 % Controls114 % Controls 95 115 md.inversion.control_parameters={'FrictionCoefficient'}; 96 116 md.inversion.gradient_scaling=50*ones(md.inversion.nsteps,1); … … 98 118 md.inversion.max_parameters=200*ones(md.mesh.numberofvertices,1); 99 119 100 % Additional parameters120 % Additional parameters 101 121 md.diagnostic.restol=0.01; 102 122 md.diagnostic.reltol=0.1; 103 123 md.diagnostic.abstol=NaN; 104 124 105 % Go solve125 % Solve 106 126 md.solver=addoptions(md.solver,NoneAnalysisEnum,asmoptions); 107 127 md.solver=addoptions(md.solver,DiagnosticVertAnalysisEnum,jacobiasmoptions); … … 110 130 md=solve(md,DiagnosticSolutionEnum); 111 131 112 % Update model friction fields accordingly132 % Update model friction fields accordingly 113 133 md.friction.coefficient=md.results.DiagnosticSolution.FrictionCoefficient; 114 134 135 % Save model 115 136 save ./Models/Pig.Control_drag md; 116 137 end 138 139 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 140 % Plot MacAyeal Results 141 if any(steps==5) 142 143 disp(' Plotting MacAyeal Model Results') 144 md = loadmodel('./Models/Pig.Control_drag'); 145 146 plotmodel(md,'nlines',2,'ncols',2,'unit#all','km','axis#all','equal',... 147 'xlim#all',[min(md.mesh.x) max(md.mesh.x)]/10^3,... 148 'ylim#all',[min(md.mesh.y) max(md.mesh.y)]/10^3,... 149 'FontSize#all',12,... 150 'data',md.initialization.vel,'title','Observed velocity',... 151 'data',md.results.DiagnosticSolution.Vel,'title','Modeled Velocity',... 152 'data',md.geometry.bed,'title','Bed elevation',... 153 'data',md.results.DiagnosticSolution.FrictionCoefficient,'title','Friction Coefficient',... 154 'colorbar#all','on','colorbartitle#1-2','[m/yr]',... 155 'caxis#1-2',([1.5,4000]),... 156 'colorbartitle#3','[m]', 'log#all',10); 157 end 158 159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 160 % Use a Blatter-Pattyn Flow Model 161 if any(steps==6) 162 163 % Load Model 164 md = loadmodel('./Models/Pig.Control_drag'); 165 md.inversion.iscontrol=0; 166 167 disp(' Extruding mesh') 168 number_of_layers=3; 169 md=extrude(md, number_of_layers, 0.9); 170 171 disp(' Using Batter-Pattyn Ice Flow Model') 172 md=setflowequation(md, 'pattyn', 'all'); 173 174 % Solve 175 md=solve(md,DiagnosticSolutionEnum); 176 177 % Save Model 178 save ./Models/Pig.Control_drag_pattyn md; 179 end 180 181 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 182 % Plot Blatter-Pattyn Results 183 if any(steps==7) 184 185 disp(' Plotting Pattyn Model Results') 186 md = loadmodel('./Models/Pig.Control_drag_pattyn'); 187 188 plotmodel(md,'nlines',2,'ncols',2,'unit#all','km','axis#all','equal',... 189 'xlim#all',[min(md.mesh.x) max(md.mesh.x)]/10^3,... 190 'ylim#all',[min(md.mesh.y) max(md.mesh.y)]/10^3,... 191 'FontSize#all',12,... 192 'data',md.initialization.vel,'title','Observed velocity',... 193 'data',md.results.DiagnosticSolution.Vel,'title','Modeled Velocity',... 194 'data',md.geometry.bed,'title','Bed elevation',... 195 'data',md.friction.coefficient,'title','Friction Coefficient',... 196 'caxis#1-2',([1.5,4000]),... 197 'colorbar#all','on','view#all',2,... 198 'colorbartitle#1-2','[m/yr]','colorbartitle#3','[m]',... 199 'layer#1-3',(md.mesh.numberoflayers),'layer#4',1, 'log#all', 10); 200 end
Note:
See TracChangeset
for help on using the changeset viewer.