source: issm/oecreview/Archive/21724-22754/ISSM-22152-22153.diff@ 22755

Last change on this file since 22755 was 22755, checked in by Mathieu Morlighem, 7 years ago

CHG: added 21724-22754

File size: 1.3 KB
  • ../trunk-jpl/src/m/geometry/VolumeAboveFloatation.m

     
     1function V = VolumeAboveFloatation(md)
     2%VOLUMEABOVEFLOATATION - returns volume above floatation
     3%
     4%   Usage:
     5%      V = VolumeAboveFloatation(md)
     6
     7%Special case if 3d
     8if isa(md.mesh,'mesh3dprisms')
     9        index = md.mesh.elements2d;
     10        x = md.mesh.x2d;
     11        y = md.mesh.y2d;
     12elseif isa(md.mesh,'mesh2d'),
     13        index = md.mesh.elements;
     14        x = md.mesh.x;
     15        y = md.mesh.y;
     16else
     17        error('not supported yet');
     18end
     19%1. get some parameters
     20rho_ice   = md.materials.rho_ice;
     21rho_water = md.materials.rho_water;
     22
     23%2. compute averages
     24base        = mean(md.geometry.base(index),2);
     25surface     = mean(md.geometry.surface(index),2);
     26bathymetry  = mean(md.geometry.bed(index),2);
     27
     28%3. get areas of all triangles
     29areas = GetAreas(index,x,y);
     30
     31%4. Compute volume above floatation
     32V = areas.*(surface-base+min(rho_water/rho_ice*bathymetry,0.));
     33
     34%5. take out the ones that are outside of levelset or floating
     35pos = find(min(md.mask.ice_levelset(index),[],2)>0 | min(md.mask.groundedice_levelset(index),[],2)<0);
     36V(pos) = 0;
     37
     38%sum individual contributions
     39V = sum(V);
Note: See TracBrowser for help on using the repository browser.