source: issm/trunk/src/m/contrib/morlighem/massbalance/divergence.m@ 20500

Last change on this file since 20500 was 20500, checked in by Mathieu Morlighem, 9 years ago

merged trunk-jpl and trunk for revision 20497

File size: 720 bytes
Line 
1function div=divergence(md,a,b)
2%DIVERGENCE - divergence of [a;b] vector, using model's triangulation.
3%
4% Usage:
5% div=divergence(md,a,b)
6
7if (dimension(md.mesh)==2),
8 numberofelements=md.mesh.numberofelements;
9 numberofnodes=md.mesh.numberofvertices;
10 index=md.mesh.elements;
11 x=md.mesh.x; y=md.mesh.y; z=md.mesh.z;
12else
13 numberofelements=md.mesh.numberofelements2d;
14 numberofnodes=md.mesh.numberofvertices2d;
15 index=md.mesh.elements2d;
16 x=md.mesh.x2d; y=md.mesh.y2d;
17end
18
19%compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
20[alpha beta]=GetNodalFunctionsCoeff(index,x,y);
21
22summation=[1;1;1];
23dx=(a(index).*alpha)*summation;
24dy=(b(index).*beta)*summation;
25
26div=dx+dy;
27div=averaging(md,div,1);
Note: See TracBrowser for help on using the repository browser.