Home > p2plib > pmnewtonloop.m

pmnewtonloop

PURPOSE ^

parallel newtonloops called from pmcont

SYNOPSIS ^

function [uold,lamold,tauold,inegp,resp,dsp,f]=pmnewtonloop(p,p0)

DESCRIPTION ^

 parallel newtonloops called from pmcont

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [uold,lamold,tauold,inegp,resp,dsp,f]=pmnewtonloop(p,p0)
0002 % parallel newtonloops called from pmcont
0003 m=p.mst; lamd=p.tau(p.neq*p.np+1);  %lamdot
0004 u0=p.u; lam0=p.lam; ds0=p.ds; tau0=p.tau; 
0005 tu=tau0(1:p.neq*p.np); tl=tau0(p.neq*p.np+1); %for multi-predictor
0006 uold=u0; lamold=lam0; tauold=tau0; % for bifdec
0007 iterp=zeros(1,m); resp=zeros(1,m); %for parallel newton loop
0008 f=[]; %f saves the results like Gu, Glam, lam and u
0009 inegp=zeros(1,m); %saves eigenvalues
0010 dsp=zeros(1,m); for i=1:m; dsp(i)=i*ds0; end
0011 p.imax=p.pmimax;    
0012 parfor i=1:m
0013   ta=1; u11p=u0+dsp(i)*tu; lam1p=lam0+dsp(i)*tl;% predictor
0014   %r=resi(p,u11p,lam1p); res0=norm(r,p.normsw);
0015   res0=100;
0016   while ta==1
0017     if(p.parasw==0 || (p.parasw==1 && abs(lamd)>p.lamdtol)) % fixed lam corrector
0018         [u11p,resp(i),iter1p,Gup,Glamp]=nlooppde(p0,u11p,lam1p);meth='nat';
0019     else % arclength-corrector
0020         %[u11p,lam1p,resp(i),iter1p,Gup,Glamp]=pnloopext(u0,lam0,tau0,p,u11p,lam1p,dsp(i)); meth='arc';
0021          [u11p,lam1p,resp(i),iter1p,Gup,Glamp]=nloopext(p,u11p,lam1p,dsp(i)); meth='arc';
0022     end
0023     iterp(i)=iter1p;
0024     if resp(i)>p.tol 
0025       if resp(i)<p.resfac*res0; res0=resp(i); % res0 independent for each i !
0026       else ta=0;  end    %stop iteration, no good point
0027     end
0028     if resp(i)<p.tol; ta=0;    %stop iteration , good point
0029       if(p.spcalcsw>0); inegp(i)=spcalc(Gup,p); end % calculate EVals
0030       f(i).Gu=Gup; f(i).Glam=Glamp; f(i).u=u11p; f(i).lam=lam1p;
0031       f(i).iter=iterp(i); f(i).meth=meth;
0032       if(p.errchecksw>0); 
0033           auxp=p; auxp.u=u11p; err=errcheck(auxp);f(i).err=err; %HU
0034       end 
0035     end % if resp(i)<p.tol
0036   end %while ta
0037 end % parfor

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