forked from dmkaplan2000/openMA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaplacian_tri.m
32 lines (28 loc) · 843 Bytes
/
laplacian_tri.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function l = laplacian_tri( p, t, u )
% LAPLACIAN_TRI
%
% Usage: laplacian = laplacian_tri( p, t, u )
%
% Compute the laplacian of u on the triangular mesh defined by p and t.
%
% Laplacian will be defined at triangle midpoints, not the nodes (as u
% should be).
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Id: laplacian_tri.m 70 2007-02-22 02:24:34Z dmk $
%
% Copyright (C) 2005 David M. Kaplan
% Licence: GPL (Gnu Public License)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gradient
[ux,uy] = pdegrad( p, t, u );
% Get gradient at nodes - this involves some information loss
uxn = pdeprtni( p, t, ux );
uyn = pdeprtni( p, t, uy );
% Now take gradient of gradient
[uxx,uxy] = pdegrad( p, t, uxn );
[uyx,uyy] = pdegrad( p, t, uyn );
% Sum is the laplacian
l = uxx + uyy;