1 | function 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)
|
---|
18 | if 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);
|
---|
23 | elseif nargin==1,
|
---|
24 | nodeonicefront=zeros(md.mesh.numberofvertices,1);
|
---|
25 | else
|
---|
26 | help SetIceShelfBC
|
---|
27 | error('bad usage');
|
---|
28 | end
|
---|
29 | pos=find(md.mesh.vertexonboundary & ~nodeonicefront);
|
---|
30 | md.diagnostic.spcvx=NaN*ones(md.mesh.numberofvertices,1);
|
---|
31 | md.diagnostic.spcvy=NaN*ones(md.mesh.numberofvertices,1);
|
---|
32 | md.diagnostic.spcvz=NaN*ones(md.mesh.numberofvertices,1);
|
---|
33 | md.diagnostic.spcvx(pos)=0;
|
---|
34 | md.diagnostic.spcvy(pos)=0;
|
---|
35 | md.diagnostic.spcvz(pos)=0;
|
---|
36 | md.diagnostic.referential=NaN*ones(md.mesh.numberofvertices,6);
|
---|
37 |
|
---|
38 | %Dirichlet Values
|
---|
39 | if (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);
|
---|
43 | else
|
---|
44 | disp(' boundary conditions for diagnostic model: spc set as zero');
|
---|
45 | end
|
---|
46 |
|
---|
47 | %segment on Ice Front
|
---|
48 | %segment on Neumann (Ice Front)
|
---|
49 | pos=find(nodeonicefront(md.mesh.segments(:,1)) | nodeonicefront(md.mesh.segments(:,2)));
|
---|
50 | if (md.mesh.dimension==2)
|
---|
51 | pressureload=md.mesh.segments(pos,:);
|
---|
52 | elseif 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
|
---|
58 | end
|
---|
59 |
|
---|
60 | %Add water or air enum depending on the element
|
---|
61 | pressureload=[pressureload 1*md.mask.elementonfloatingice(pressureload(:,end))];
|
---|
62 |
|
---|
63 | %plug onto model
|
---|
64 | md.diagnostic.icefront=pressureload;
|
---|
65 |
|
---|
66 | %Create zeros basalforcings and surfaceforcings
|
---|
67 | if (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');
|
---|
70 | end
|
---|
71 | if 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');
|
---|
74 | end
|
---|
75 | if 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');
|
---|
78 | end
|
---|
79 | if 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');
|
---|
82 | end
|
---|
83 |
|
---|
84 | md.prognostic.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
|
---|
85 | md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
|
---|
86 |
|
---|
87 | if (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
|
---|
93 | else
|
---|
94 | disp(' no thermal boundary conditions created: no observed temperature found');
|
---|
95 | end
|
---|