www.pudn.com > 87361026FEA.rar > lsupdate.m, change:2002-10-01,size:1275b


function phi=lsupdate(node,conn,phi,F,delt)

% function phi=lsupdate(node,conn,phi,F,delt)
%
% This function performs an update of a level set field phi on a finite
% element descretization using a Taylor-Galerkin stabilized finite element
% scheme.  Node is the nodal coordinate matrix, conn is the element 
% connectivity matrix, F is the nodal speed function, delt is the 
% time step and elemType it the element type.

% INITIALIZE DATA STRUCTURES
numNode=size(node,1);
numElem=size(conn,1);
M=zeros(numNode,1);
fint=zeros(numNode,1);

% COMPUTE invM and fint
[W,Q]=quadrature(2,'TRIANGULAR',2);
for e=1:numElem

  sctr=conn(e,:); 
   
  for q=1:size(W)
    
    [N,dNdxi]=lagrange_basis('T3',Q(q,:));
    J=node(sctr,:)'*dNdxi;
    detJ=det(J);
    dNdx=dNdxi*inv(J);
    
    gradPhi=phi(sctr)'*dNdx;
    normal=gradPhi/norm(gradPhi);
    dNdn=dNdx*normal';
    dPhidn=phi(sctr)'*dNdn;
    
    Fpt=N'*F(sctr);
    
    % advection part
    fint(sctr) = fint(sctr) - N*Fpt*norm(gradPhi)*W(q)*detJ;  
    
    % stabilization part
    fint(sctr) = fint(sctr) - delt/2*dNdn*Fpt^2*dPhidn'*W(q)*detJ;
     
    % lumped mass
    M(sctr) = M(sctr) + sum(N*N'*W(q)*detJ)';
    
  end % of quadrature loop
  
end % of element loop

% UPDATE LEVEL SET
phi = phi + delt*fint./M;