Home > p2plib > inistep.m

inistep

PURPOSE ^

initial step in cont; yields first 2 points on branch and first tangent

SYNOPSIS ^

function [p,iok]=inistep(p)

DESCRIPTION ^

 initial step in cont; yields first 2 points on branch and first tangent 
 (secant) vector

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p,iok]=inistep(p)
0002 % initial step in cont; yields first 2 points on branch and first tangent
0003 % (secant) vector
0004 iok1=0;iok2=0; [p.u,res]=nlooppde(p,p.u,p.lam); ineg=-1;
0005 if(res<p.tol) 
0006     fprintf('got first point with lam=%g, res=%g \n',p.lam,res);
0007     if(p.spcalcsw>0); % spectral calc
0008         r=resi(p,p.u,p.lam); Gu=getGu(p,p.u,p.lam,r); 
0009         [ineg,muv]=spcalc(Gu,p); 
0010     end
0011     if(p.errchecksw>0); p.err=errcheck(p);end 
0012     brout=p.outfu(p,p.u,p.lam); % userfu to append to bif-branches
0013     p.branch=[p.branch [p.count; ineg; p.lam; p.err; brout]]; % put on branch
0014     figure(p.brfig); hold on; % plot point
0015     if(ineg<=0) plot(p.lam,brout(p.bpcmp),'*'); else plot(p.lam,brout(p.bpcmp),'+'); end 
0016     if p.smod~=0 % save to file
0017             fname=[p.pname,sprintf('%i',p.count),'.mat']; save(fname,'p'); 
0018     end 
0019     iok1=1;p.count=p.count+1;
0020 else fprintf('no convergence in zeroth step, lam=%g, res=%g\n',p.lam,res);
0021 end
0022 lam=p.lam;p.lam=lam+p.ds/10;fprintf('now lam=%g\n',p.lam); 
0023 [u,res]=nlooppde(p,p.u,p.lam); 
0024 if(res<p.tol) 
0025     fprintf('got second point with lam=%g, res=%g \n',p.lam,res);
0026     if(p.spcalcsw>0); r=resi(p,u,p.lam); Gu=getGu(p,u,p.lam,r);    
0027         [ineg,muv]=spcalc(Gu,p); end
0028     if(p.errchecksw>0); p.err=errcheck(p);end 
0029     brout=p.outfu(p,u,p.lam); % userfu to append to bif-branches
0030     p.branch=[p.branch [p.count; ineg; p.lam; p.err; brout]]; % put on branch
0031     figure(p.brfig); hold on; % plot point
0032     if(ineg<=0) plot(p.lam,brout(p.bpcmp),'*'); else plot(p.lam,brout(p.bpcmp),'+'); end 
0033     if(mod(p.count-1,p.smod)==0) 
0034         fname=[p.pname,sprintf('%i',p.count),'.mat']; save(fname,'p'); end  % save to file
0035     iok2=1;p.count=p.count+1;
0036 else fprintf('no convergence in first step, lam=%g, res=%g\n',p.lam,res);
0037 end
0038 iok=iok1*iok2; tau=[(u-p.u)/(p.lam-lam); 1]; 
0039 p.u=u;p.tau=tau/xinorm(tau,p.xi);p.restart=1; p.ineg=ineg;

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