Home > demos > acgc > acgcinit.m

acgcinit

PURPOSE ^

init-routine for acgc

SYNOPSIS ^

function p=acgcinit(p,icsel)

DESCRIPTION ^

 init-routine for acgc

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function p=acgcinit(p,icsel) 
0002 % init-routine for acgc
0003 p=stanparam(p); p.neq=1; p.outfu=@acgcbra; 
0004 p.lss=@gclss; p.blss=@gcblss; p.f=@acgcf; p.jac=@acgcjac; 
0005 pre=sprintf('%s',inputname(1));p=setfn(p,pre);
0006 lx=pi/2; ly=pi/2; [p.geo,bc]=recdbc1(lx,ly,1e4);p.bcf=@(p,u,lam) bc; 
0007 nx=30; ny=nx*round(ly/lx); p=stanmesh(p,nx,ny); p=setbmesh(p); 
0008 p.tau=zeros(p.neq*p.np+1,1); p.tau(p.neq*p.np+1)=1; p.xi=1/p.np; 
0009 p.nsteps=30; p.jsw=0; p.tol=1e-8; p.pstyle=3; p.smod=5; p.bifchecksw=0; 
0010 p.spcalcsw=0; p.lammin=-1; p.lammax=1; p.bpcmp=1;
0011 p.imax=10; p.dsinciter=p.imax/4; 
0012 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% starting point %%%%%%%%%%%%%%%%%%%%%%%%%%%%
0013 p.lam=1; p.ds=-0.1; p.c1=1; p.c2=0; p.c3=1; p.c5=-1; p.d=0.1; 
0014 x=p.points(1,:)'; y=p.points(2,:)';
0015 if icsel==1; wi=4; p.u=2*tanh(wi*(x-lx)).*tanh(wi*(x+lx)).* ...
0016         tanh(wi*(y-ly)).*tanh(wi*(y+ly));
0017 end
0018 if icsel==2; p.lam=1; p.u=1*cos(x).*cos(y); end 
0019 res=norm(resi(p,p.u,p.lam), p.normsw); um=triint(p.u,p.points,p.tria); 
0020 fprintf('initial res=%g, um=%g\n',res,um);
0021 plotsol(p,1,1,1); 
0022 [p.u,res,iter]=nlooppde(p,p.u,p.lam); um=triint(p.u,p.points,p.tria); 
0023 fprintf('first res=%g with iter=%i, um=%g\n',res,iter,um);
0024 plotsol(p,1,1,p.pstyle);
0025

Generated on Wed 15-Aug-2012 12:53:02 by m2html © 2005