source: issm/branches/trunk-dlcheng-ASE/src/m/boundaryconditions/SetMarineIceSheetBC.m@ 27955

Last change on this file since 27955 was 26352, checked in by jdquinn, 4 years ago

CHG: Cleanup of warning messages

File size: 4.3 KB
Line 
1function md=SetMarineIceSheetBC(md,varargin)
2%SETICEMARINESHEETBC - Create the boundary conditions for stressbalance and thermal models for a Marine Ice Sheet with Ice Front
3%
4% Neumann BC are used on the ice front (an ARGUS contour around the ice front
5% can be given in input, or it will be deduced as onfloatingice & onboundary)
6% Dirichlet BC are used elsewhere for stressbalance
7%
8% Usage:
9% md=SetMarineIceSheetBC(md,icefrontfile)
10% md=SetMarineIceSheetBC(md)
11%
12% Example:
13% md=SetMarineIceSheetBC(md,'Front.exp')
14% md=SetMarineIceSheetBC(md)
15%
16% See also: SETICESHELFBC, SETMARINEICESHEETBC
17
18%node on Dirichlet (boundary and ~icefront)
19if nargin==2,
20 %User provided Front.exp, use it
21 icefrontfile=varargin{1};
22 if ~exist(icefrontfile)
23 error(['SetMarineIceSheetBC error message: ice front file ' icefrontfile ' not found']);
24 end
25 [path,name,ext]=fileparts(icefrontfile);
26 if strcmp(ext,'.shp'),
27 contours=shpread(icefrontfile);
28 elseif strcmp(ext,'.exp'),
29 contours=expread(icefrontfile);
30 end
31 incontour=ContourToMesh(md.mesh.elements,md.mesh.x,md.mesh.y,contours,'node',2);
32 vertexonicefront=double(md.mesh.vertexonboundary & incontour);
33else
34 %Guess where the ice front is
35 pos=find(sum(md.mask.ocean_levelset(md.mesh.elements)<0.,2) >0.);
36 vertexonfloatingice=zeros(md.mesh.numberofvertices,1);
37 vertexonfloatingice(md.mesh.elements(pos,:))=1.;
38 vertexonicefront=double(md.mesh.vertexonboundary & vertexonfloatingice);
39end
40pos=find(md.mesh.vertexonboundary & ~vertexonicefront);
41if isempty(pos),
42 disp('Warning: SetMarineIceSheetBC.m: ice front all around the glacier, no dirichlet applied')
43end
44md.stressbalance.spcvx=NaN*ones(md.mesh.numberofvertices,1);
45md.stressbalance.spcvy=NaN*ones(md.mesh.numberofvertices,1);
46md.stressbalance.spcvz=NaN*ones(md.mesh.numberofvertices,1);
47md.stressbalance.referential=NaN*ones(md.mesh.numberofvertices,6);
48md.stressbalance.loadingforce=0*ones(md.mesh.numberofvertices,3);
49
50%Position of ice front
51md.mask.ice_levelset(find(vertexonicefront))=0;
52
53%First find segments that are not completely on the front
54if strcmp(elementtype(md.mesh),'Penta'),
55 numbernodesfront=4;
56elseif strcmp(elementtype(md.mesh),'Tria'),
57 numbernodesfront=2;
58else
59 error('mesh type not supported yet');
60end
61segmentsfront=md.mask.ice_levelset(md.mesh.segments(:,1:numbernodesfront))==0;
62segments=find(sum(segmentsfront,2)~=numbernodesfront);
63%Find all nodes for these segments and spc them
64pos=md.mesh.segments(segments,1:numbernodesfront);
65md.stressbalance.spcvx(pos(:))=0;
66md.stressbalance.spcvy(pos(:))=0;
67md.stressbalance.spcvz(pos(:))=0; % FIXME probably shouldn't spc vertical velocity here
68
69%Dirichlet Values
70if (length(md.inversion.vx_obs)==md.mesh.numberofvertices & length(md.inversion.vy_obs)==md.mesh.numberofvertices)
71 disp(' boundary conditions for stressbalance model: spc set as observed velocities');
72 md.stressbalance.spcvx(pos)=md.inversion.vx_obs(pos);
73 md.stressbalance.spcvy(pos)=md.inversion.vy_obs(pos);
74else
75 disp(' boundary conditions for stressbalance model: spc set as zero');
76end
77
78md.hydrology.spcwatercolumn=zeros(md.mesh.numberofvertices,2);
79pos=find(md.mesh.vertexonboundary);
80md.hydrology.spcwatercolumn(pos,1)=1;
81
82%Initialize surface and basal forcings
83md.smb = initialize(md.smb,md);
84md.basalforcings = initialize(md.basalforcings,md);
85
86%Deal with other boundary conditions
87if isnan(md.balancethickness.thickening_rate),
88 md.balancethickness.thickening_rate=zeros(md.mesh.numberofvertices,1);
89 disp(' no balancethickness.thickening_rate specified: values set as zero');
90end
91
92md.masstransport.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
93md.balancethickness.spcthickness=NaN*ones(md.mesh.numberofvertices,1);
94md.damage.spcdamage=NaN*ones(md.mesh.numberofvertices,1);
95
96if (length(md.initialization.temperature)==md.mesh.numberofvertices),
97 md.thermal.spctemperature=NaN*ones(md.mesh.numberofvertices,1);
98 if isprop(md.mesh,'vertexonsurface'),
99 pos=find(md.mesh.vertexonsurface);
100 md.thermal.spctemperature(pos)=md.initialization.temperature(pos); %impose observed temperature on surface
101 end
102 if (length(md.basalforcings.geothermalflux)~=md.mesh.numberofvertices),
103 md.basalforcings.geothermalflux=zeros(md.mesh.numberofvertices,1);
104 md.basalforcings.geothermalflux(find(md.mask.ocean_levelset>0.))=50.*10.^-3; %50mW/m2
105 end
106else
107 disp(' no thermal boundary conditions created: no observed temperature found');
108end
Note: See TracBrowser for help on using the repository browser.