source: issm/branches/trunk-jpl-damage/src/m/utils/BC/SetIceShelfBC.m@ 12946

Last change on this file since 12946 was 12946, checked in by cborstad, 13 years ago

CHG: merged trunk-jpl into branch through revision 12945

File size: 4.1 KB
Line 
1function md=SetIceShelfBC(md,varargin)
2%SETICESHELFBC - Create the boundary conditions for diagnostic and thermal models for a Ice Shelf with Ice Front
3%
4% Neumann BC are used on the ice front (an ANRGUS contour around the ice front
5% must be given in input)
6% Dirichlet BC are used elsewhere for diagnostic
7%
8% Usage:
9% md=SetIceShelfBC(md,varargin)
10%
11% Example:
12% md=SetIceShelfBC(md);
13% md=SetIceShelfBC(md,'Front.exp');
14%
15% See also: SETICESHEETBC, SETMARINEICESHEETBC
16
17%node on Dirichlet (boundary and ~icefront)
18if nargin==2,
19 icefrontfile=varargin{1};
20 if ~exist(icefrontfile), error(['SetIceShelfBC error message: ice front file ' icefrontfile ' not found']); end
21 nodeinsideicefront=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,icefrontfile,'node',2);
22 nodeonicefront=double(md.mesh.vertexonboundary & nodeinsideicefront);
23elseif nargin==1,
24 nodeonicefront=zeros(md.mesh.numberofvertices,1);
25else
26 help SetIceShelfBC
27 error('bad usage');
28end
29pos=find(md.mesh.vertexonboundary & ~nodeonicefront);
30md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
31md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
32md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
33md.diagnostic.spcvx(pos)=0;
34md.diagnostic.spcvy(pos)=0;
35md.diagnostic.spcvz(pos)=0;
36md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6);
37
38%Dirichlet Values
39if (length(md.inversion.vx_obs)==md.mesh.numberofvertices & length(md.inversion.vy_obs)==md.mesh.numberofvertices)
40 disp(' boundary conditions for diagnostic model: spc set as observed velocities');
41 md.diagnostic.spcvx(pos)=md.inversion.vx_obs(pos);
42 md.diagnostic.spcvy(pos)=md.inversion.vy_obs(pos);
43else
44 disp(' boundary conditions for diagnostic model: spc set as zero');
45end
46
47%segment on Ice Front
48%segment on Neumann (Ice Front)
49pos=find(nodeonicefront(md.mesh.segments(:,1)) | nodeonicefront(md.mesh.segments(:,2)));
50if (md.mesh.dimension==2)
51 pressureload=md.mesh.segments(pos,:);
52elseif md.mesh.dimension==3
53 pressureload_layer1=[md.mesh.segments(pos,1:2) md.mesh.segments(pos,2)+md.mesh.numberofvertices2d md.mesh.segments(pos,1)+md.mesh.numberofvertices2d md.mesh.segments(pos,3)];
54 pressureload=[];
55 for i=1:md.mesh.numberoflayers-1,
56 pressureload=[pressureload ;pressureload_layer1(:,1:4)+(i-1)*md.mesh.numberofvertices2d pressureload_layer1(:,5)+(i-1)*md.mesh.numberofelements2d ];
57 end
58end
59
60%Add water or air enum depending on the element
61pressureload=[pressureload 1*md.mask.elementonfloatingice(pressureload(:,end))];
62
63%plug onto model
64md.diagnostic.icefront=pressureload;
65
66%Create zeros basalforcings and surfaceforcings
67if (isnan(md.surfaceforcings.precipitation) & (md.surfaceforcings.ispdd==1) & (md.surfaceforcings.ispdd==0)),
68 md.surfaceforcings.precipitation=zeros(md.mesh.numberofvertices,1);
69 disp(' no surfaceforcings.precipitation specified: values set as zero');
70end
71if isnan(md.surfaceforcings.mass_balance) & (md.surfaceforcings.ispdd==0),
72 md.surfaceforcings.mass_balance=zeros(md.mesh.numberofvertices,1);
73 disp(' no surfaceforcings.mass_balance specified: values set as zero');
74end
75if isnan(md.basalforcings.melting_rate),
76 md.basalforcings.melting_rate=zeros(md.mesh.numberofvertices,1);
77 disp(' no basalforcings.melting_rate specified: values set as zero');
78end
79if isnan(md.balancethickness.thickening_rate),
80 md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices,1);
81 disp(' no balancethickness.thickening_rate specified: values set as zero');
82end
83
84md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
85md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
86
87if (length(md.initialization.temperature)==md.mesh.numberofvertices),
88 md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
89 pos=find(md.mesh.vertexonsurface); md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
90 if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices),
91 md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
92 end
93else
94 disp(' no thermal boundary conditions created: no observed temperature found');
95end
Note: See TracBrowser for help on using the repository browser.