Changeset 2986 for issm/trunk/src/m/classes/public/geography2.m
- Timestamp:
- 02/08/10 14:12:12 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/geography2.m
r1758 r2986 1 1 function md=geography2(md,landname,iceshelfname,icesheetname) 2 %GEOGRAPHY2 - establish land, ice sheet and ice shelf areas in a domains. 3 % 4 % Usage: 5 % md=geography2(md,landname,iceshelfname,icesheetname) 6 % 7 % Examples: 8 % md=geography2(md,'LandName.exp','Iceshelves.exp','Islands.exp'); 2 9 3 10 %Get assigned fields … … 7 14 8 15 %recover elements and grids on land. 9 [gridonland,elementonland]=ContourToMesh(elements,x,y,expread(landname,1),'element and node',2); 16 if ischar(landname), 17 [gridonland,elementonland]=ContourToMesh(elements,x,y,expread(landname,1),'element and node',2); 18 elseif isfloat(landname), 19 if size(landname,1)~=md.numberofelements, 20 error('Landname for area must be of same size as number of elements in model'); 21 end 22 elementonland=landname; 23 gridonland=zeros(md.numberofgrids,1); 24 gridonland(md.elements(find(elementonland),:))=1; 25 else 26 error('Invalid area option option'); 27 end 10 28 11 29 %any element with 3 grids on land should be on land: … … 42 60 43 61 %recover arrays of ice shelf grids and elements, and ice sheet grids and elements. 44 if strcmp(iceshelfname,''), %no iceshelf contour file, we are dealing with a pure ice sheet. 45 gridoniceshelf=zeros(md.numberofgrids,1); 46 elementoniceshelf=zeros(md.numberofelements,1); 47 elseif strcmp(iceshelfname,'all'), %we are dealing with a pure ice shelf. 48 gridoniceshelf=ones(md.numberofgrids,1); 49 elementoniceshelf=ones(md.numberofelements,1); 50 else 51 [gridoniceshelf,elementoniceshelf]=ContourToMesh(elements,x,y,expread(iceshelfname,1),'element and node',2); 52 end 62 elementoniceshelf=FlagElements(md,iceshelfname); 63 elementonicesheet=FlagElements(md,icesheetname); 53 64 54 if strcmp(icesheetname,''), %no icesheet contour file, we are dealing with a pure ice shelf. 55 gridonicesheet=zeros(md.numberofgrids,1); 56 elementonicesheet=zeros(md.numberofelements,1); 57 else 58 [gridonicesheet,elementonicesheet]=ContourToMesh(elements,x,y,expread(icesheetname,1),'element and node',2); 59 end 60 65 %Because icesheet grids and elements can be included into an iceshelf, we need to update. Remember, all the previous 66 %arrays come from domain outlines that can intersect one another: 67 gridoniceshelf=zeros(md.numberofgrids,1); 68 gridonicesheet=zeros(md.numberofgrids,1); 69 elementoniceshelf=double((elementoniceshelf & ~elementonicesheet)); 70 elementonicesheet=double(~elementoniceshelf); 71 gridoniceshelf(md.elements(find(elementoniceshelf),:))=1; 72 gridonicesheet(md.elements(find(elementonicesheet),:))=1; 61 73 62 74 %now correct, so that none of the iceshelf and icesheet elements and nodes are in the water.
Note:
See TracChangeset
for help on using the changeset viewer.