Changeset 9640


Ignore:
Timestamp:
09/07/11 08:24:03 (14 years ago)
Author:
Mathieu Morlighem
Message:

temporary commit

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)
     1function md=setmask(md,floatingicename,groundedicename)
    22%GEOGRAPHY - establish boundaries between grounded and floating ice.
    33%
    4 %   By default, ice is considered grounded. The contour iceshelfname defines nodes
    5 %   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,
    66%   that are grounded (ie: ice rises, islands, etc ...)
    77%   All input files are in the Argus format (extension .exp).
    88%
    99%   Usage:
    10 %      md=geography(md,iceshelfname,icesheetname)
     10%      md=setmask(md,floatingicename,groundedicename)
    1111%
    1212%   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');
    1515
    1616%some checks on list of arguments
    1717if ((nargin~=3) | (nargout~=1)),
    18         help geography
    19         error('geography error message');
     18        help mask
     19        error('mask error message');
    2020end
    2121
     
    2525elements=md.elements;
    2626
    27 %Assign elementoniceshelf, elementonicesheet, nodeonicesheet and nodeoniceshelf. Only change at your own peril! This is synchronized heavily with the GroundingLineMigration module. {{{1
    28 elementoniceshelf=FlagElements(md,iceshelfname);
    29 elementonicesheet=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
     28elementonfloatingice=FlagElements(md,floatingicename);
     29elementongroundedice=FlagElements(md,groundedicename);
    3030
    31 %Because icesheet nodes and elements can be included into an iceshelf, we need to update. Remember, all the previous
     31%Because groundedice nodes and elements can be included into an floatingice, we need to update. Remember, all the previous
    3232%arrays come from domain outlines that can intersect one another:
    33 elementoniceshelf=double((elementoniceshelf & ~elementonicesheet));
    34 elementonicesheet=double(~elementoniceshelf);
     33elementonfloatingice=double((elementonfloatingice & ~elementongroundedice));
     34elementongroundedice=double(~elementonfloatingice);
    3535
    36 %the order here is important. we choose nodeonicesheet as 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.
     37vertexonfloatingice=zeros(md.numberofnodes,1);
     38vertexongroundedice=zeros(md.numberofnodes,1);
     39vertexongroundedice(md.elements(find(elementongroundedice),:))=1;
     40vertexonfloatingice(find(~vertexongroundedice))=1;
    4141%}}}
    4242
    4343%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);
     44md.mask.elementonfloatingice=elementonfloatingice;
     45md.mask.vertexonfloatingice=vertexonfloatingice;
     46md.mask.elementongroundedice=elementongroundedice;
     47md.mask.vertexongroundedice=vertexongroundedice;
     48md.mask.vertexonwater=zeros(md.numberofnodes,1);
     49md.mask.elementonwater=zeros(md.numberofelements,1);
  • TabularUnified issm/trunk/src/m/model/mask2.m

    r9636 r9640  
    1 function md=geography2(md,landname,iceshelfname,icesheetname)
     1function md=setmask2(md,landname,floatingicename,groundedicename)
    22%GEOGRAPHY2 - establish land, ice sheet and ice shelf areas in a domains.
    33%
    44%   Usage:
    5 %      md=geography2(md,landname,iceshelfname,icesheetname)
     5%      md=setmask2(md,landname,floatingicename,groundedicename)
    66%
    77%   Examples:
    8 %      md=geography2(md,'LandName.exp','Iceshelves.exp','Islands.exp');
     8%      md=setmask2(md,'LandName.exp','Iceshelves.exp','Islands.exp');
    99
    1010%Get assigned fields
     
    1515%recover elements and nodes on land.
    1616if 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);
    1818elseif isfloat(landname),
    1919        if size(landname,1)~=md.numberofelements,
     
    2121        end
    2222        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;
    2525else
    2626        error('Invalid area option option');
     
    3737%any element with 3 nodes on land should be on land:
    3838elementsonwater=find(~elementonland);
    39 wrongelements=elementsonwater(find(( nodeonland(md.elements(elementsonwater,1)) + nodeonland(md.elements(elementsonwater,2)) + nodeonland(md.elements(elementsonwater,3)) ...
     39wrongelements=elementsonwater(find(( vertexonland(md.elements(elementsonwater,1)) + vertexonland(md.elements(elementsonwater,2)) + vertexonland(md.elements(elementsonwater,3)) ...
    4040                  )==3));
    4141elementonland(wrongelements)=1;
     
    7070
    7171%recover arrays of ice shelf nodes and elements, and ice sheet nodes and elements.
    72 elementoniceshelf=FlagElements(md,iceshelfname);
    73 elementonicesheet=FlagElements(md,icesheetname);
     72elementonfloatingice=FlagElements(md,floatingicename);
     73elementongroundedice=FlagElements(md,groundedicename);
    7474
    75 %Because icesheet nodes and elements can be included into an iceshelf, we need to update. Remember, all the previous
     75%Because groundedice nodes and elements can be included into an floatingice, we need to update. Remember, all the previous
    7676%arrays come from domain outlines that can intersect one another:
    77 nodeoniceshelf=zeros(md.numberofnodes,1);
    78 nodeonicesheet=zeros(md.numberofnodes,1);
    79 elementoniceshelf=double((elementoniceshelf & ~elementonicesheet));
    80 elementonicesheet=double(~elementoniceshelf);
    81 nodeoniceshelf(md.elements(find(elementoniceshelf),:))=1;
    82 nodeonicesheet(md.elements(find(elementonicesheet),:))=1;
     77vertexonfloatingice=zeros(md.numberofnodes,1);
     78vertexongroundedice=zeros(md.numberofnodes,1);
     79elementonfloatingice=double((elementonfloatingice & ~elementongroundedice));
     80elementongroundedice=double(~elementonfloatingice);
     81vertexonfloatingice(md.elements(find(elementonfloatingice),:))=1;
     82vertexongroundedice(md.elements(find(elementongroundedice),:))=1;
    8383
    84 %now correct, so that none of the iceshelf and icesheet elements and nodes are in the water.
     84%now correct, so that none of the floatingice and groundedice elements and nodes are in the water.
    8585pos=find(~elementonland);
    86 elementoniceshelf(pos)=0;
    87 elementonicesheet(pos)=0;
     86elementonfloatingice(pos)=0;
     87elementongroundedice(pos)=0;
    8888
    89 pos=find(~nodeonland);
    90 nodeoniceshelf(pos)=0;
    91 nodeonicesheet(pos)=0;
     89pos=find(~vertexonland);
     90vertexonfloatingice(pos)=0;
     91vertexongroundedice(pos)=0;
    9292
    93 %create nodeonwater and elementonwater:
    94 nodeonwater=double(~nodeonland);
     93%create vertexonwater and elementonwater:
     94vertexonwater=double(~vertexonland);
    9595elementonwater=double(~elementonland);
    9696
    9797%correct for islands:
    98 nodeoniceshelf=double(nodeoniceshelf & ~nodeonicesheet);
    99 elementoniceshelf=double(elementoniceshelf & ~elementonicesheet);
     98vertexonfloatingice=double(vertexonfloatingice & ~vertexongroundedice);
     99elementonfloatingice=double(elementonfloatingice & ~elementongroundedice);
    100100
    101 %now, icesheets are everything except iceshelves and water
    102 nodeonicesheet=double(~nodeoniceshelf & ~nodeonwater);
    103 elementonicesheet=double(~elementoniceshelf & ~elementonwater);
     101%now, groundedices are everything except iceshelves and water
     102vertexongroundedice=double(~vertexonfloatingice & ~vertexonwater);
     103elementongroundedice=double(~elementonfloatingice & ~elementonwater);
    104104
    105105%Deal with segments on neumann:
     
    124124%some final checks:
    125125%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);
     126nodesgrounded=find(~vertexonwater);
    127127lengthconnectivity=size(md.nodeconnectivity,2);
    128128groundedcounters=md.nodeconnectivity(nodesgrounded,lengthconnectivity);
     
    134134errornodes=nodesgrounded(errorflags);
    135135
    136 nodeonwater(errornodes)=1;
    137 nodeonicesheet(errornodes)=0;
    138 nodeoniceshelf(errornodes)=0;
     136vertexonwater(errornodes)=1;
     137vertexongroundedice(errornodes)=0;
     138vertexonfloatingice(errornodes)=0;
    139139
    140140%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;
     141md.mask.vertexonfloatingice=vertexonfloatingice;
     142md.mask.elementonfloatingice=elementonfloatingice;
     143md.mask.vertexonwater=vertexonwater;
     144md.mask.elementonwater=elementonwater;
     145md.mask.vertexongroundedice=vertexongroundedice;
     146md.mask.elementongroundedice=elementongroundedice;
    149147
    150148md.segmentmarkers(:)=1;
Note: See TracChangeset for help on using the changeset viewer.