Home > p2plib > meshadac.m

meshadac

PURPOSE ^

adapt mesh after Coarsening, i.e. first interpol to (coarse) standard-mesh, then adapt

SYNOPSIS ^

function p=meshadac(p,varargin)

DESCRIPTION ^

 adapt mesh after Coarsening, i.e. first interpol to (coarse) standard-mesh, then adapt

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function p=meshadac(p,varargin) 
0002 % adapt mesh after Coarsening, i.e. first interpol to (coarse) standard-mesh, then adapt
0003 fprintf('current nt=%g, base nt=%g, ', p.nt, size(p.btria,2)); noa=nargin-1; 
0004 q=p; ps=p.points; nps=p.np; onp=size(p.bpoints,2); % save current points to later interpolate tau
0005 lamd=p.tau(p.neq*nps+1); % remember lam-direction
0006 xo = p.points(1,:);yo = p.points(2,:);
0007 xn = p.bpoints(1,:);yn = p.bpoints(2,:);
0008 for i=1:p.neq % interpol to coarse mesh
0009     z = p.u((i-1)*nps+1:i*nps);un=p2interpol(xn,yn,z,xo,yo); 
0010     uc((i-1)*onp+1:i*onp)=un; 
0011 end 
0012 p.points=p.bpoints; p.edges=p.bedges; p.tria=p.btria; p.np=onp; 
0013 p.nt=size(p.tria,2); p.u=uc'; 
0014 if(noa>0); p=meshada(p,varargin{:}); % refine the coarse mesh
0015 else p=meshada(p);
0016 end
0017 figure(p.ifig);pdemesh(p.points,p.edges,p.tria);axis tight; 
0018 plotsol(p,p.pfig,p.pcmp,p.pstyle); xi=1/p.np; 
0019 if(p.isw>1); fprintf('old xi=%g, new xi=%g\n',p.xi,xi); 
0020     xi=asknu('xi:',xi); end 
0021 p.xi=xi; 
0022 tau=zeros(p.np*p.neq,1); xn = p.points(1,:);yn = p.points(2,:);
0023 for i=1:p.neq % interpolate tau
0024   z=p.tau((i-1)*nps+1:i*nps);taun=p2interpol(xn,yn,z,xo,yo); 
0025   tau((i-1)*p.np+1:i*p.np) = taun; 
0026 end
0027 tau(p.np*p.neq+1)=lamd;  % append dlam coordinate and normalize
0028 p.tau=tau/xinorm(tau,p.xi);p.headfu(p);

Generated on Wed 15-Aug-2012 10:09:15 by m2html © 2005