Home > Src > Elliptic_1d > call_adr_1d.m

call_adr_1d

PURPOSE ^

CALL_ADR_1D Script for producing data of figure 1.4, pag. 21, CHQZ2

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 CALL_ADR_1D Script for producing  data of figure 1.4, pag. 21, CHQZ2

 to produce data of figure 1.4, pag. 21, CHQZ2:  
>> p=1; call_adr_1d;
>> p=2; call_adr_1d;
>> p=3; call_adr_1d;
>> p=4; call_adr_1d;

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % CALL_ADR_1D Script for producing  data of figure 1.4, pag. 21, CHQZ2
0002 %
0003 % to produce data of figure 1.4, pag. 21, CHQZ2:
0004 %>> p=1; call_adr_1d;
0005 %>> p=2; call_adr_1d;
0006 %>> p=3; call_adr_1d;
0007 %>> p=4; call_adr_1d;
0008 
0009 xa=-1;xb=1; 
0010 
0011 % sets functions
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'; % c.b.: the first character specifies boundary condition in xa
0031         % the second character specifies boundary condition in xb
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; %[10,20,40,80,160] % number of spectral elements
0037 for nx=nnx % spectral polynomial degree (the same in every element)
0038     H=(xb-xa)/ne;
0039 param(1:6)=[1,0,nx*2,1,0,64]; % see help adr_1d
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

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003