Changeset 9640
- Timestamp:
- 09/07/11 08:24:03 (14 years ago)
- Location:
- issm/trunk/src/m/model
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/m/model/mask.m ¶
r9636 r9640 1 function md= geography(md,iceshelfname,icesheetname)1 function md=setmask(md,floatingicename,groundedicename) 2 2 %GEOGRAPHY - establish boundaries between grounded and floating ice. 3 3 % 4 % By default, ice is considered grounded. The contour iceshelfname defines nodes5 % for which ice is floating. The contour icesheetname defines nodes inside an iceshelf,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, 6 6 % that are grounded (ie: ice rises, islands, etc ...) 7 7 % All input files are in the Argus format (extension .exp). 8 8 % 9 9 % Usage: 10 % md= geography(md,iceshelfname,icesheetname)10 % md=setmask(md,floatingicename,groundedicename) 11 11 % 12 12 % Examples: 13 % md= geography(md,'all','');14 % md= geography(md,'Iceshelves.exp','Islands.exp');13 % md=setmask(md,'all',''); 14 % md=setmask(md,'Iceshelves.exp','Islands.exp'); 15 15 16 16 %some checks on list of arguments 17 17 if ((nargin~=3) | (nargout~=1)), 18 help geography19 error(' geographyerror message');18 help mask 19 error('mask error message'); 20 20 end 21 21 … … 25 25 elements=md.elements; 26 26 27 %Assign elementon iceshelf, elementonicesheet, nodeonicesheet and nodeoniceshelf. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{128 elementon iceshelf=FlagElements(md,iceshelfname);29 elementon icesheet=FlagElements(md,icesheetname);27 %Assign elementonfloatingice, elementongroundedice, vertexongroundedice and vertexonfloatingice. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{1 28 elementonfloatingice=FlagElements(md,floatingicename); 29 elementongroundedice=FlagElements(md,groundedicename); 30 30 31 %Because icesheet nodes and elements can be included into an iceshelf, we need to update. Remember, all the previous31 %Because groundedice nodes and elements can be included into an floatingice, we need to update. Remember, all the previous 32 32 %arrays come from domain outlines that can intersect one another: 33 elementon iceshelf=double((elementoniceshelf & ~elementonicesheet));34 elementon icesheet=double(~elementoniceshelf);33 elementonfloatingice=double((elementonfloatingice & ~elementongroundedice)); 34 elementongroundedice=double(~elementonfloatingice); 35 35 36 %the order here is important. we choose nodeonicesheetas default on the grounding line.37 nodeoniceshelf=zeros(md.numberofnodes,1);38 nodeonicesheet=zeros(md.numberofnodes,1);39 nodeonicesheet(md.elements(find(elementonicesheet),:))=1;40 nodeoniceshelf(find(~nodeonicesheet))=1;36 %the order here is important. we choose vertexongroundedice as default on the grounding line. 37 vertexonfloatingice=zeros(md.numberofnodes,1); 38 vertexongroundedice=zeros(md.numberofnodes,1); 39 vertexongroundedice(md.elements(find(elementongroundedice),:))=1; 40 vertexonfloatingice(find(~vertexongroundedice))=1; 41 41 %}}} 42 42 43 43 %Return: 44 md.elementoniceshelf=elementoniceshelf; 45 md.nodeoniceshelf=nodeoniceshelf; 46 47 md.elementonicesheet=elementonicesheet; 48 md.nodeonicesheet=nodeonicesheet; 49 50 md.nodeonwater=zeros(md.numberofnodes,1); 51 md.elementonwater=zeros(md.numberofelements,1); 44 md.mask.elementonfloatingice=elementonfloatingice; 45 md.mask.vertexonfloatingice=vertexonfloatingice; 46 md.mask.elementongroundedice=elementongroundedice; 47 md.mask.vertexongroundedice=vertexongroundedice; 48 md.mask.vertexonwater=zeros(md.numberofnodes,1); 49 md.mask.elementonwater=zeros(md.numberofelements,1); -
TabularUnified issm/trunk/src/m/model/mask2.m ¶
r9636 r9640 1 function md= geography2(md,landname,iceshelfname,icesheetname)1 function md=setmask2(md,landname,floatingicename,groundedicename) 2 2 %GEOGRAPHY2 - establish land, ice sheet and ice shelf areas in a domains. 3 3 % 4 4 % Usage: 5 % md= geography2(md,landname,iceshelfname,icesheetname)5 % md=setmask2(md,landname,floatingicename,groundedicename) 6 6 % 7 7 % Examples: 8 % md= geography2(md,'LandName.exp','Iceshelves.exp','Islands.exp');8 % md=setmask2(md,'LandName.exp','Iceshelves.exp','Islands.exp'); 9 9 10 10 %Get assigned fields … … 15 15 %recover elements and nodes on land. 16 16 if ischar(landname), 17 [ nodeonland,elementonland]=ContourToMesh(elements,x,y,landname,'element and node',2);17 [vertexonland,elementonland]=ContourToMesh(elements,x,y,landname,'element and node',2); 18 18 elseif isfloat(landname), 19 19 if size(landname,1)~=md.numberofelements, … … 21 21 end 22 22 elementonland=landname; 23 nodeonland=zeros(md.numberofnodes,1);24 nodeonland(md.elements(find(elementonland),:))=1;23 vertexonland=zeros(md.numberofnodes,1); 24 vertexonland(md.elements(find(elementonland),:))=1; 25 25 else 26 26 error('Invalid area option option'); … … 37 37 %any element with 3 nodes on land should be on land: 38 38 elementsonwater=find(~elementonland); 39 wrongelements=elementsonwater(find(( nodeonland(md.elements(elementsonwater,1)) + nodeonland(md.elements(elementsonwater,2)) + nodeonland(md.elements(elementsonwater,3)) ...39 wrongelements=elementsonwater(find(( vertexonland(md.elements(elementsonwater,1)) + vertexonland(md.elements(elementsonwater,2)) + vertexonland(md.elements(elementsonwater,3)) ... 40 40 )==3)); 41 41 elementonland(wrongelements)=1; … … 70 70 71 71 %recover arrays of ice shelf nodes and elements, and ice sheet nodes and elements. 72 elementon iceshelf=FlagElements(md,iceshelfname);73 elementon icesheet=FlagElements(md,icesheetname);72 elementonfloatingice=FlagElements(md,floatingicename); 73 elementongroundedice=FlagElements(md,groundedicename); 74 74 75 %Because icesheet nodes and elements can be included into an iceshelf, we need to update. Remember, all the previous75 %Because groundedice nodes and elements can be included into an floatingice, we need to update. Remember, all the previous 76 76 %arrays come from domain outlines that can intersect one another: 77 nodeoniceshelf=zeros(md.numberofnodes,1);78 nodeonicesheet=zeros(md.numberofnodes,1);79 elementon iceshelf=double((elementoniceshelf & ~elementonicesheet));80 elementon icesheet=double(~elementoniceshelf);81 nodeoniceshelf(md.elements(find(elementoniceshelf),:))=1;82 nodeonicesheet(md.elements(find(elementonicesheet),:))=1;77 vertexonfloatingice=zeros(md.numberofnodes,1); 78 vertexongroundedice=zeros(md.numberofnodes,1); 79 elementonfloatingice=double((elementonfloatingice & ~elementongroundedice)); 80 elementongroundedice=double(~elementonfloatingice); 81 vertexonfloatingice(md.elements(find(elementonfloatingice),:))=1; 82 vertexongroundedice(md.elements(find(elementongroundedice),:))=1; 83 83 84 %now correct, so that none of the iceshelf and icesheetelements and nodes are in the water.84 %now correct, so that none of the floatingice and groundedice elements and nodes are in the water. 85 85 pos=find(~elementonland); 86 elementon iceshelf(pos)=0;87 elementon icesheet(pos)=0;86 elementonfloatingice(pos)=0; 87 elementongroundedice(pos)=0; 88 88 89 pos=find(~ nodeonland);90 nodeoniceshelf(pos)=0;91 nodeonicesheet(pos)=0;89 pos=find(~vertexonland); 90 vertexonfloatingice(pos)=0; 91 vertexongroundedice(pos)=0; 92 92 93 %create nodeonwater and elementonwater:94 nodeonwater=double(~nodeonland);93 %create vertexonwater and elementonwater: 94 vertexonwater=double(~vertexonland); 95 95 elementonwater=double(~elementonland); 96 96 97 97 %correct for islands: 98 nodeoniceshelf=double(nodeoniceshelf & ~nodeonicesheet);99 elementon iceshelf=double(elementoniceshelf & ~elementonicesheet);98 vertexonfloatingice=double(vertexonfloatingice & ~vertexongroundedice); 99 elementonfloatingice=double(elementonfloatingice & ~elementongroundedice); 100 100 101 %now, icesheets are everything except iceshelves and water102 nodeonicesheet=double(~nodeoniceshelf & ~nodeonwater);103 elementon icesheet=double(~elementoniceshelf& ~elementonwater);101 %now, groundedices are everything except iceshelves and water 102 vertexongroundedice=double(~vertexonfloatingice & ~vertexonwater); 103 elementongroundedice=double(~elementonfloatingice & ~elementonwater); 104 104 105 105 %Deal with segments on neumann: … … 124 124 %some final checks: 125 125 %check that no node thinks it's on an ice shelf or ice sheet, and lies actually in the middle of the water. 126 nodesgrounded=find(~ nodeonwater);126 nodesgrounded=find(~vertexonwater); 127 127 lengthconnectivity=size(md.nodeconnectivity,2); 128 128 groundedcounters=md.nodeconnectivity(nodesgrounded,lengthconnectivity); … … 134 134 errornodes=nodesgrounded(errorflags); 135 135 136 nodeonwater(errornodes)=1;137 nodeonicesheet(errornodes)=0;138 nodeoniceshelf(errornodes)=0;136 vertexonwater(errornodes)=1; 137 vertexongroundedice(errornodes)=0; 138 vertexonfloatingice(errornodes)=0; 139 139 140 140 %Return: 141 md.nodeoniceshelf=nodeoniceshelf; 142 md.elementoniceshelf=elementoniceshelf; 143 144 md.nodeonwater=nodeonwater; 145 md.elementonwater=elementonwater; 146 147 md.nodeonicesheet=nodeonicesheet; 148 md.elementonicesheet=elementonicesheet; 141 md.mask.vertexonfloatingice=vertexonfloatingice; 142 md.mask.elementonfloatingice=elementonfloatingice; 143 md.mask.vertexonwater=vertexonwater; 144 md.mask.elementonwater=elementonwater; 145 md.mask.vertexongroundedice=vertexongroundedice; 146 md.mask.elementongroundedice=elementongroundedice; 149 147 150 148 md.segmentmarkers(:)=1;
Note:
See TracChangeset
for help on using the changeset viewer.