필터 지우기
필터 지우기

pde mass transfer with reaction

조회 수: 6 (최근 30일)
Mr.DDWW
Mr.DDWW 2022년 5월 12일
편집: Torsten 2022년 5월 12일
initial condition
(BC1)
(BC2)
I think S= lamda* theat^@ but I do not know how to write it in matlab. Can you please correct the BC's
%HERE IS MY CODE
clc;clear all;close all;
L = 1;
x = linspace(0,L,50);
t = linspace(0,1,50);
% t = [linspace(0,0.05,20), linspace(0.5,5,10)];
m = 1;
sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t);
% colormap hot
sol1=1-sol;
figure(1)
surf(x,t,sol1);
% imagesc(x,t,sol)
% colorbar
% plot3(x,t,sol)
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Fig 12.1-1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx)
c = 1;
f = dudx;
s = 0;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = ul-1;
ql = 0;
pr = ur+1 ;
qr = 0;
end

답변 (1개)

Torsten
Torsten 2022년 5월 12일
편집: Torsten 2022년 5월 12일
clc;clear all;close all;
L = 1;
x = linspace(0,L,50);
t = linspace(0,1,50);
% t = [linspace(0,0.05,20), linspace(0.5,5,10)];
m = 0;
lambda = 1.0;
sol = pdepe(m,@(x,t,u,dudx)heatpde(x,t,u,dudx,lambda),@heatic,@heatbc,x,t);
sol1 = 1-sol(:,:,1); % Don't know why you want to plot 1-theta instead of theta
% colormap hot
figure(1)
surf(x,t,sol1);
% imagesc(x,t,sol)
% colorbar
% plot3(x,t,sol)
xlabel('y/b');
zlabel('(T-T_0)/(T_1-T_0)');
title('Fig 12.1-1'); grid on;
function [c,f,s] = heatpde(x,t,u,dudx,lambda)
c = 1;
f = dudx;
s = -lambda^2*u;
end
function u0 = heatic(x)
u0 = 0;
end
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
pl = 0.0;
ql = 1.0;
pr = ur-1 ;
qr = 0.0;
end

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by