PDEPE: Spatial Discretization has failed
Show older comments
I want to solve this system of partial differential equations: 0.661*du/dt=d/dx(0.051du/dx)-0.1du/dx-0.97*k*(qm-q); dq/dt=k*(qm-q); k=0.01; p=8.314*3.23*1.09*u(1); q1=2.983*100*(0.336*p/(1+0.336*p)+0.0000000005046*power(p,12.608)/(1+0.0000000005046*power(p,12.608))); function pdefun
if true
% code
end
function[c,f,s]=pdefun(z,t,u,du)
p=8.314*3.23*1.09*u(1);
q1=2.983*100*(0.336*p/(1+0.336*p)+0.0000000005046*power(p,12.608)/(1+0.0000000005046*power(p,12.608)));
c=[0.661;1];
f=[0.0051*du(1);0];
s=[-0.1*du(1)-0.97*0.01*(q1-u(2));0.01*(q1-u(2))];
function pdeic
function[u0]=pdeic(z)
u0=[0;0];
function pdebc
function[pa,qa,pb,qb]=pdebc(za,ua,zb,ub,t)
pa=[ua(1)-0.00002;0];qa=[0;0];
pb=[0;0];qb=[1;0];z=0:0.01:1;t=0:30:3600;m=0;
sol=pdepe(m,@pdefun,@pdeic,@pdebc,z,t);
u1=sol(:,:,1);
u2=sol(:,:,2);
fid=fopen('cc.txt','wt');
for i=1:101
fprintf(fid,'%d',u1(i,:));
fprintf(fid,'\n');
end
fclose(fid);
fid=fopen('qq.txt','wt');
for i=1:101
fprintf(fid,'%d',u2(i,:));
fprintf(fid,'\n');
end
fclose(fid);
where did i wrong ?
thank you
Accepted Answer
More Answers (0)
Categories
Find more on PDE Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!