pde mass transfer with reaction
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Torsten
am 12 Mai 2022
Bearbeitet: Torsten
am 12 Mai 2022
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu PDE Solvers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!