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