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 | |
---|
1 | function 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 |
|
---|
7 | if (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;
|
---|
12 | else
|
---|
13 | numberofelements=md.mesh.numberofelements2d;
|
---|
14 | numberofnodes=md.mesh.numberofvertices2d;
|
---|
15 | index=md.mesh.elements2d;
|
---|
16 | x=md.mesh.x2d; y=md.mesh.y2d;
|
---|
17 | end
|
---|
18 |
|
---|
19 | %compute nodal functions coefficients N(x,y)=alpha x + beta y + gamma
|
---|
20 | [alpha beta]=GetNodalFunctionsCoeff(index,x,y);
|
---|
21 |
|
---|
22 | summation=[1;1;1];
|
---|
23 | dx=(a(index).*alpha)*summation;
|
---|
24 | dy=(b(index).*beta)*summation;
|
---|
25 |
|
---|
26 | div=dx+dy;
|
---|
27 | div=averaging(md,div,1);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.