0001 function [p,stepok,u1,lam1,res,iter,Gu,Glam]=cfail(p,u1,lam1,res,iter,Gu,Glam,dss)
0002
0003
0004
0005
0006
0007
0008
0009
0010 fprintf('NO CONVERGENCE, ds=%g, dsmin=%g, tol=%g, res=%g \n', p.ds,p.dsmin,p.tol,res);
0011 stepok=0; choi=0;
0012 if(p.isw>0);
0013 fprintf('options:\n0: return, 1: change dsmin, 2: change tol, 3: change other sw/param,\n');
0014 fprintf('4: correct with fixed lam, 5: refine mesh, 6: adapt mesh\n');
0015 choi=asknu('your choice:',choi);
0016 end
0017 switch choi;
0018 case 0; stepok=-1; return;
0019 case 1; p.dsmin=p.dsmin/2; p.dsmin=asknu('new dsmin',p.dsmin);
0020 case 2; p.tol=p.tol*2; p.tol=asknu('new tol',p.tol); if (res<p.tol); stepok=1; end;
0021 case 3; p.imax=asknu('imax',p.imax); p.dlammax=asknu('new dlammax',p.dlammax);
0022 case 4; p.imax=asknu('imax',p.imax);
0023 [u1,res,iter,Gu,Glam]=nlooppde(p,u1,lam1);
0024 if(res<p.tol) fprintf('now res=%g, OK\n',res); stepok=1; end
0025 case 5; p.imax=asknu('imax',p.imax); [p,res]=meshref(p); p.ds=dss;
0026 case 6; p.imax=asknu('imax',p.imax); [p,res]=meshadac(p); p.ds=dss;
0027 end