time dependent PDE

조회 수: 6 (최근 30일)
Danning
Danning 2012년 3월 16일
I have a time dependent problem. The general form is C*du/dt=d2u/dx2 Now C is also changing with t. C=1/D*exp(-A/(b*t+d)+A/d). A, b and d are fixed numbers.
I have the code as below,it works for fixed C=1/D where t=0.but it seems that the C changing with t does not get into co-operated, coz I get the same results with C=1/D*exp(-A/(b*t+d)+A/d) and C=1/D(where t =0) C does not really depend on t from the results.
My question is how to make C depends on t and get the right results.
Thank you! .............................................................
function Desorption2 %dimension unit in mm, s
m = 0;
x = linspace(0,0.1778,100);
t = linspace(0,3550,100);
sol = pdepe(m,@(~,~,~,DuDx) pdex1pde(DuDx,t),@pdex1ic,@pdex1bc,x,t);
% Extract the first solution component as u.
u = sol(:,:,1);
surf(x,t,u)
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance x')
ylabel('Time t')
figure
plot(x,u(end,:))
title(['Solution at t = ' num2str(t(end)) ])
xlabel('Distance x')
ylabel(['u(x,' num2str(t(end)) ')'])
%write results in file
fid = fopen('25C_3550.txt', 'w');
fprintf(fid, '%e\n',x,u(end,:));
fclose(fid);
end
function [c,f,s] = pdex1pde(DuDx,t)
c =1./(1.110e-014*exp(-5327./(0.0417*t+298)+5327/298)*1000000);
f = DuDx;
s = 0;
end
function u0 = pdex1ic(~)
u0 = 0.0001;
end
% -------------------------------------------------------------- function [pl,ql,pr,qr] = pdex1bc(~,ul,~,ur,~)
pl = ul;
ql = 0;
pr = ur;
qr = 0;
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 1-D Partial Differential Equations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by