source: issm/trunk/src/m/model/slope.m@ 9451

Last change on this file since 9451 was 9451, checked in by Mathieu Morlighem, 14 years ago

removed all other model fields to be deleted

File size: 795 bytes
RevLine 
[1]1function [sx,sy,s]=slope(md)
2%SLOPE - compute the surface slope
3%
4% Usage:
5% [sx,sy,s]=slope(md)
6
7%load some variables (it is much faster if the variab;es are loaded from md once for all)
[3994]8if (md.dim==2),
[1]9 numberofelements=md.numberofelements;
[8298]10 numberofnodes=md.numberofnodes;
[1]11 index=md.elements;
[9451]12 x=md.x; y=md.y;
[1]13else
14 numberofelements=md.numberofelements2d;
[8298]15 numberofnodes=md.numberofnodes2d;
[1]16 index=md.elements2d;
[9451]17 x=md.x2d; y=md.y2d;
[1]18end
19
20%compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
[1236]21[alpha beta]=GetNodalFunctionsCoeff(index,x,y);
[1]22
23summation=[1;1;1];
24sx=(md.surface(index).*alpha)*summation;
25sy=(md.surface(index).*beta)*summation;
26s=sqrt(sx.^2+sy.^2);
27
[3994]28if md.dim==3,
[1]29 sx=project3d(md,sx,'element');
30 sy=project3d(md,sy,'element');
31 s=sqrt(sx.^2+sy.^2);
32end
Note: See TracBrowser for help on using the repository browser.