geography

PURPOSE ^

GEOGRAPHY - establish boundaries between grounded and floating ice.

SYNOPSIS ^

function md=geography(md,iceshelfname,icesheetname)

DESCRIPTION ^

GEOGRAPHY - establish boundaries between grounded and floating ice.

   By default, ice is considered grounded. The contour iceshelfname defines grids 
   for which ice is floting. The contour icesheetname defines grids inside an iceshelf, 
   that are grounded (ie: ice rises, islands, etc ...)
   All input files are in the Argus format (extension .exp).

   Usage:
      md=geography(md,iceshelfname,icesheetname)

   Examples:
      md=geography(md,'all','');
      md=geography(md,'Iceshelves.exp','Islands.exp');

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function md=geography(md,iceshelfname,icesheetname)
0002 %GEOGRAPHY - establish boundaries between grounded and floating ice.
0003 %
0004 %   By default, ice is considered grounded. The contour iceshelfname defines grids
0005 %   for which ice is floting. The contour icesheetname defines grids inside an iceshelf,
0006 %   that are grounded (ie: ice rises, islands, etc ...)
0007 %   All input files are in the Argus format (extension .exp).
0008 %
0009 %   Usage:
0010 %      md=geography(md,iceshelfname,icesheetname)
0011 %
0012 %   Examples:
0013 %      md=geography(md,'all','');
0014 %      md=geography(md,'Iceshelves.exp','Islands.exp');
0015 
0016 %some checks on list of arguments
0017 if ((nargin~=3) | (nargout~=1)),
0018     geographyusage();
0019     error('geography error message');
0020 end
0021 if ((~ischar(iceshelfname)) | (~ischar(icesheetname))  )
0022     geographyusage();
0023     error('geography error message');
0024 end
0025 
0026 if md.counter>=2,
0027     choice=input('This model already has a geometry. Are you sure you want to go ahead? (y/n)','s');
0028     if ~strcmp(choice,'y')
0029         error('no geometry done ... exiting');
0030     end
0031 else
0032     if (md.counter~=1)
0033         error('geography error message: you need to run mesh.m first on this model');
0034     else
0035         md.counter=2;
0036     end
0037 end
0038 
0039 %Get assigned fields
0040 x=md.x;
0041 y=md.y;
0042 elements=md.elements;
0043 
0044 %Fist recover arrays of ice shelf grids and elements, and ice sheet grids and elements.
0045 if strcmp(iceshelfname,''), %no iceshelf contour file, we are dealing with a pure ice sheet.
0046     gridoniceshelf=zeros(md.numberofgrids,1);
0047     elementoniceshelf=zeros(md.numberofelements,1);
0048 elseif strcmp(iceshelfname,'all'), %we are dealing with a pure ice shelf.
0049     gridoniceshelf=ones(md.numberofgrids,1);
0050     elementoniceshelf=ones(md.numberofelements,1);
0051 else
0052     [gridoniceshelf,elementoniceshelf]=ArgusContourToMesh(elements,x,y,expread(iceshelfname,1),'element and node',2);
0053 end
0054 
0055 if strcmp(icesheetname,''), %no icesheet contour file, we are dealing with a pure ice shelf.
0056     gridonicesheet=zeros(md.numberofgrids,1);
0057     elementonicesheet=zeros(md.numberofelements,1);
0058 else
0059     [gridonicesheet,elementonicesheet]=ArgusContourToMesh(elements,x,y,expread(icesheetname,1),'element and node',2);
0060 end
0061 
0062 %Because icesheet grids and elements can be included into an iceshelf, we need to update. Remember, all the previous
0063 %arrays come from domain outlines that can intersect one another:
0064 gridoniceshelf=double((gridoniceshelf & ~gridonicesheet));
0065 elementoniceshelf=double((elementoniceshelf & ~elementonicesheet));
0066 gridonicesheet=double(~gridoniceshelf);
0067 elementonicesheet=double(~elementoniceshelf);
0068 
0069 %Return:
0070 md.elementoniceshelf=elementoniceshelf;
0071 md.gridoniceshelf=gridoniceshelf;
0072 
0073 md.elementonicesheet=elementonicesheet;
0074 md.gridonicesheet=gridonicesheet;
0075 
0076 %Keep track of input files
0077 if strcmp(iceshelfname,''), md.iceshelfoutline=''; elseif strcmp(iceshelfname,'all'), md.iceshelfoutline='all'; else md.iceshelfoutline=readfile(iceshelfname); end
0078 if strcmp(icesheetname,''), md.icesheetoutline=''; elseif strcmp(icesheetname,'all'), md.icesheetoutline='all'; else md.icesheetoutline=readfile(icesheetname); end
0079 
0080 function geographyusage(),
0081 disp('INPUT md=geography(md,iceshelfname,icesheetname)');
0082 disp('geography:  establish boundaries between grounded and floating ice.');
0083 disp('     By default, ice is considered grounded. The contour iceshelfname defines grids ');
0084 disp('     for which ice is floting. The contour icesheetname defines grids inside an iceshelf, ');
0085 disp('     that are grounded (ie: ice rises, islands, etc ...)');
0086 disp('     All input files are in the Argus format (extension .exp');

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003