source: issm/trunk-jpl/src/m/parameterization/setmask.m

Last change on this file was 24861, checked in by Mathieu Morlighem, 5 years ago

CHG: renaming groundedice_levelset -> ocean_levelset (negative if ocean present, positive outside

File size: 2.5 KB
RevLine 
[17432]1function md=setmask(md,floatingicename,groundedicename,varargin)
[11234]2%SETMASK - establish boundaries between grounded and floating ice.
[1]3%
[9640]4% By default, ice is considered grounded. The contour floatingicename defines nodes
5% for which ice is floating. The contour groundedicename defines nodes inside an floatingice,
[1]6% that are grounded (ie: ice rises, islands, etc ...)
7% All input files are in the Argus format (extension .exp).
8%
9% Usage:
[9640]10% md=setmask(md,floatingicename,groundedicename)
[1]11%
12% Examples:
[9640]13% md=setmask(md,'all','');
14% md=setmask(md,'Iceshelves.exp','Islands.exp');
[1]15
16%some checks on list of arguments
[17433]17if ((mod(nargin,2)==0) | (nargout~=1)),
[9640]18 help mask
19 error('mask error message');
[1]20end
21
[17433]22if(nargin>3)
23 if(varargin(1)=='icedomain'),
[17432]24 icedomainname=varargin(2);
25 else
26 error('mask error message: wrong field specified. Only icedomain allowed for now.');
27 end
28 if ~exist(icedomainname),
29 error(['setmask error message: file ' icedomainname ' not found!']);
30 end
31end
32
[1]33%Get assigned fields
[9734]34x=md.mesh.x;
35y=md.mesh.y;
[9733]36elements=md.mesh.elements;
[1]37
[12365]38%Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{
[9640]39elementonfloatingice=FlagElements(md,floatingicename);
40elementongroundedice=FlagElements(md,groundedicename);
[1]41
[9640]42%Because groundedice nodes and elements can be included into an floatingice, we need to update. Remember, all the previous
[1]43%arrays come from domain outlines that can intersect one another:
[9640]44elementonfloatingice=double((elementonfloatingice & ~elementongroundedice));
45elementongroundedice=double(~elementonfloatingice);
[7314]46
[9640]47%the order here is important. we choose vertexongroundedice as default on the grounding line.
[9725]48vertexonfloatingice=zeros(md.mesh.numberofvertices,1);
49vertexongroundedice=zeros(md.mesh.numberofvertices,1);
[9733]50vertexongroundedice(md.mesh.elements(find(elementongroundedice),:))=1;
[9640]51vertexonfloatingice(find(~vertexongroundedice))=1;
[7314]52%}}}
53
[15944]54%level sets
[24861]55md.mask.ocean_levelset=vertexongroundedice;
56md.mask.ocean_levelset(find(vertexongroundedice==0.))=-1.;
[17432]57
[17433]58if(nargin>3)
59 if(varargin(1)=='icedomain')
[17432]60 md.mask.ice_levelset = 1.*ones(md.mesh.numberofvertices,1);
61 %use contourtomesh to set ice values inside ice domain
62 [vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomainname,'node',1);
63 pos=find(vertexinsideicedomain==1.);
64 md.mask.ice_levelset(pos) = -1.;
65 end
66else
67 md.mask.ice_levelset = -1.*ones(md.mesh.numberofvertices,1);
68end
69
70
Note: See TracBrowser for help on using the repository browser.