0001
0002
0003
0004
0005
0006
0007
0008
0009 xa=-1;xb=1;
0010
0011
0012
0013 [uex,uexx,ff,nu,beta,gam]=setfun_adr_1d;
0014
0015 if p==1
0016 nne=[10,20,40,80,160,320];
0017 nnx=1;
0018 elseif p==2
0019 nne=[10,20,40,80,160];
0020 nnx=2;
0021 elseif p==3
0022 nne=[10,20,40,80,108];
0023 nnx=3;
0024 elseif p==4
0025 nne=1; nnx=4:8:40;
0026 end
0027
0028 param=zeros(10,1);
0029 nomefile=['dt2',num2str(p),'.dat'];
0030 cb='dn';
0031
0032 fid=fopen(nomefile,'w');
0033 fprintf(fid,'1D Advection-diffusion-reaction problem, FEM/SM\n');
0034 fprintf(fid,'p noe e_inf e_l2 e_h1 der \n');
0035
0036 for ne=nne;
0037 for nx=nnx
0038 H=(xb-xa)/ne;
0039 param(1:6)=[1,0,nx*2,1,0,64];
0040 [xy,un,err_inf,err_l2,err_h1,der]=adr_1d(xa,xb,nu,beta,gam,uex,uexx,ff,cb,ne,p,nx,param);
0041 noe=length(xy);
0042 fprintf('p=%d, noe=%d, e_inf=%8.2e, e_l2=%8.2e, e_h1=%8.2e, der=%8.2e \n',...
0043 p,noe,err_inf,err_l2,err_h1,der);
0044 fprintf(fid,'%d %d %8.2e %8.2e %8.2e %8.2e\n',...
0045 p, noe,err_inf,err_l2,err_h1,der);
0046 end
0047 end
0048 fclose(fid);
0049