Changeset 1338


Ignore:
Timestamp:
07/16/09 14:55:38 (16 years ago)
Author:
Mathieu Morlighem
Message:

new way of calling meshyams

Location:
issm/trunk/src/m
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/classes/public/BasinConstrain.m

    r1308 r1338  
    6161md.dirichletvalues_diag(grids,2)=md.vy_obs(grids);
    6262
    63 
    64 %make sure any grid with NaN velocity is spc'd:
    65 pos=find(isnan(md.vel_obs_raw));
    66 md.gridondirichlet_diag(pos)=1;
    67 %we spc to the smoothed value, so that control methods don't go berserk trying to figure out what reaction force to apply for the spc to stand.
    68 md.dirichletvalues_diag(pos,1)=md.vx_obs(pos);
    69 md.dirichletvalues_diag(pos,2)=md.vy_obs(pos);
    70 
    7163%make sure icefronts that are completely spc'd are taken out:
    7264free_segments=find(sum(md.gridondirichlet_diag(md.segmentonneumann_diag(:,1:2)),2)~=2);
  • issm/trunk/src/m/classes/public/extrude.m

    r1298 r1338  
    3636end
    3737
    38 if extrusionexponent<0,
     38if extrusionexponent<=0,
    3939        help extrude;
    40         error('extrusionexponent must be >0');
     40        error('extrusionexponent must be >=0');
    4141end
    4242
  • issm/trunk/src/m/classes/public/mesh/meshyams.m

    r1337 r1338  
    1 function md=meshyams(md,velpath,domainoutline,varargin);
     1function md=meshyams(md,varargin);
    22%MESHYAMS - Build model of Antarctica by refining according to observed velocity error estimator
    33%
    44%   Usage:
    5 %      md=meshyams;
     5%      md=meshyams(md,varargin);
     6%      where varargin is a lit of paired arguments.
     7%      arguments can be: 'domainoutline': Argus file containing the outline of the domain to be meshed
     8%      arguments can be: 'velocities': matlab file containing the velocities [m/yr]
     9%      optional arguments: 'groundeddomain': Argus file containing the outline of the grounded ice
     10%                          this option is used to minimize the metric on water (no refinement)
     11%      optional arguments: 'resolution': initial mesh resolution [m]
     12%      optional arguments: 'nsteps': number of steps of mesh adaptation
     13%      optional arguments: 'epsilon': average interpolation error wished [m/yr]
     14%      optional arguments: 'hmin': minimum edge length
     15%      optional arguments: 'hmanx': maximum edge
     16%     
     17%
     18%   Examples:
     19%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat');
     20%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp');
     21%      md=meshyams(md,'domainoutline','Domain.exp','velocities','vel.mat','groundeddomain','ground.exp','nsteps',6,'epsilon',2,'hmin',500,'hmax',30000);
    622
    7 %PIG settings
    8 %{
    9 nsteps=4;
    10 resolution=10000;
    11 hmin=1500;
    12 hmax=10^7;
    13 gradation=3*ones(nsteps,1);
    14 epsilon=10^-0;
    15 scale=1;
    16 %}
     23%recover options
     24yamsoptions=recover_options(varargin{:});
    1725
    18 %%{
    19 %Antarctica settings
    20 nsteps=6;
    21 resolution=5000;
    22 hmin=300;        %300m
    23 hmax=150*10^3;   %150km
    24 gradation=[1.5*ones(2,1);3*ones(nsteps-2,1)];
    25 epsilon=2*10^-0; %3m/a interpolation error
    26 scale=1;
    27 %%}
     26%add default options
     27yamsoptions=process_mesh_options(yamsoptions);
    2828
    29 %check number of arguments
    30 waterflag=0;
    31 if nargin==4,
    32         groundedoutline=varargin{1};
    33         if exist(groundedoutline);
    34                 disp(['grounded ice domain found. Metric will be minimum on water']);
    35                 waterflag=1;
    36         else
    37                 error(['MeshYams error message: file ' groundedoutline ' not found.']);
    38         end
    39 end
     29%recover some fields
     30domainoutline=yamsoptions.domainoutline;
     31groundeddomain=yamsoptions.groundeddomain;
     32velocities=yamsoptions.velocities;
     33resolution=yamsoptions.resolution;
     34gradation=yamsoptions.gradation;
     35nsteps=yamsoptions.nsteps;
     36epsilon=yamsoptions.epsilon;
     37hmin=yamsoptions.hmin;
     38hmax=yamsoptions.hmax;
    4039
    4140%mesh with initial resolution
     41disp('Initial mesh generation...');
    4242md=mesh(md,domainoutline,resolution);
    4343
    4444%load velocities
    45 load(velpath);
    46 
    47 disp(['First mesh, number of elements: ' num2str(md.numberofelements)]);
     45disp('loading velocities...');
     46load(velocities);
    4847
    4948%start mesh adaptation
     
    5352        %interpolate velocities onto mesh
    5453        disp('   interpolating velocities');
    55         md.vx_obs=InterpFromGrid(x_m,y_m,vx,md.x,md.y,0)*scale;
    56         md.vy_obs=InterpFromGrid(x_m,y_m,vy,md.x,md.y,0)*scale;
    57         md.vel_obs=averaging(md,sqrt(md.vx_obs.^2+md.vy_obs.^2),2);
     54        vx_obs=InterpFromGrid(x_m,y_m,vx,md.x,md.y,0);
     55        vy_obs=InterpFromGrid(x_m,y_m,vy,md.x,md.y,0);
     56        field=averaging(md,sqrt(vx_obs.^2+vy_obs.^2),2);
    5857
    5958        %set gridonwater field
    60         if waterflag,
    61                 gridground=ContourToMesh(md.elements,md.x,md.y,expread(groundedoutline,1),'node',2);
     59        if ~strcmp(groundeddomain,'N/A'),
     60                gridground=ContourToMesh(md.elements,md.x,md.y,expread(groundeddomain,1),'node',2);
    6261                md.gridonwater=ones(md.numberofgrids,1);
    6362                md.gridonwater(find(gridground))=0;
     
    6867        %adapt according to velocities
    6968        disp('   adapting');
    70         md=YamsCall(md,md.vel_obs,hmin,hmax,gradation(i),epsilon);
     69        md=YamsCall(md,field,hmin,hmax,gradation(i),epsilon);
    7170end
    7271       
     
    7877
    7978%Recreate the segments
     79disp('Creating segments...');
    8080elementconnectivity=md.elementconnectivity;
    8181elementonboundary=double(elementconnectivity(:,end)==0);
  • issm/trunk/src/m/classes/public/recover_areas.m

    r41 r1338  
    1515
    1616        %make sure length(varargin) is even
    17         varargin=varargin{1};
    1817        if mod(length(varargin),2),
    1918                error('recover_elementstype_options error message: an even number of options is necessary');
  • issm/trunk/src/m/classes/public/setelementstype.m

    r1298 r1338  
    2626end
    2727
    28 [hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin);
     28[hutterflag macayealflag pattynflag stokesflag filltype]=recover_areas(md,varargin{:});
    2929
    3030%Flag the elements that has not been flagged as filltype
  • issm/trunk/src/m/classes/public/solve.m

    r1030 r1338  
    2020
    2121%recover options
    22 options=recover_solve_options(md,varargin{:});
     22options=recover_options(varargin{:});
    2323
    2424%add default options
Note: See TracChangeset for help on using the changeset viewer.