Changeset 421


Ignore:
Timestamp:
05/14/09 09:53:05 (16 years ago)
Author:
Mathieu Morlighem
Message:

SetMarineIceSheetBC can be done without Front.exp file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/utils/BC/SetMarineIceSheetBC.m

    r40 r421  
    1 function md=SetMarineIceSheetBC(md,icefrontfile)
     1function md=SetMarineIceSheetBC(md,varargin)
    22%SETICEMARINESHEETBC - Create the boundary conditions for diagnostic and thermal models for a  Marine Ice Sheet with Ice Front
    33%
    4 %   Neumann BC are used on the ice front (an ANRGUS contour around the ice front
    5 %   must be given in input)
     4%   Neumann BC are used on the ice front (an ARGUS contour around the ice front
     5%   can be given in input, or it will be deduced as oniceshelf & onboundary)
    66%   Dirichlet BC are used elsewhere for diagnostic
    77%
    88%   Usage:
    99%      md=SetMarineIceSheetBC(md,icefrontfile)
     10%      md=SetMarineIceSheetBC(md)
    1011%
    1112%   Example:
    1213%      md=SetMarineIceSheetBC(md,'Front.exp')
     14%      md=SetMarineIceSheetBC(md)
    1315%
    1416%   See also: SETICESHELFBC, SETMARINEICESHEETBC
    1517
    1618%grid on Dirichlet (boundary and ~icefront)
    17 if ~exist(icefrontfile)
    18         error(['SetMarineIceSheetBC error message: ice front file ' icefrontfile ' not found']);
     19if nargin==2,
     20        %User provided Front.exp, use it
     21        icefrontfile=varargin{1};
     22        if ~exist(icefrontfile)
     23                error(['SetMarineIceSheetBC error message: ice front file ' icefrontfile ' not found']);
     24        end
     25        gridinsideicefront=ContourToMesh(md.elements,md.x,md.y,expread(icefrontfile,1),'node',2);
     26        gridonicefront=double(md.gridonboundary & gridinsideicefront);
     27
     28else
     29        %Guess where the ice front is
     30        pos=find(md.gridonboundary & md.gridoniceshelf);
     31        md.gridondirichlet_diag=zeros(md.numberofgrids,1);
     32        md.gridondirichlet_diag(pos)=1;
    1933end
    20 gridinsideicefront=ContourToMesh(md.elements,md.x,md.y,expread(icefrontfile,1),'node',2);
    21 gridonicefront=double(md.gridonboundary & gridinsideicefront);
    2234pos=find(md.gridonboundary & ~gridonicefront);
     35if isempty(pos),
     36        error('SetMarineIceSheetBC error message: ice front all around the glacier, no dirichlet found. Set BC manually')
     37end
    2338md.gridondirichlet_diag=zeros(md.numberofgrids,1);
    2439md.gridondirichlet_diag(pos)=1;
Note: See TracChangeset for help on using the changeset viewer.