MATLAB: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

errorheat conductionodepde

I am solving a heat conduction problem using pde solver. Here is the full question:
A solid body occupying the space from y = 0 to y = ∞ is initially at temperature T0. Beginning at time t=0, a periodic heat flux given by ??=?0cos?? , is imposed at y = 0. Here ?0 is the amplitude of the heat flux oscillations, and ω is the frequency.
The code I use is:
function heateqn
global rho cp k
global q t0 w q0
L=Inf; %m
t0=100;
q0=10 ;
w=100;
k=200; %W/m-K
rho=10000; %kg/m^3
cp=500; %J/kg-K
q=100; %W/m^2
tend=10; %seconds
m = 0;
x = linspace(0,L,200);
t = linspace(0,tend,50);
% solving
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
% Post processing
Temperature = sol(:,:,1);
% Plot temperature vs. length
figure, plot(x,Temperature(end,:))
title(strcat('Solution at t = ', num2str(tend)))
xlabel('Distance x')
ylabel('Temperature (C)')
%
figure, plot(t,Temperature(:,1))
title('Temperature (C)')
xlabel('Time (s)')
ylabel('Temperature (C)')
% --------------------------------------------------------------


function [c,f,s] = pdex1pde(x,t,u,DuDx)
global rho cp k
c = rho*cp;
f = k*DuDx;
s = 0;
% --------------------------------------------------------------
% end


function u0 = pdex1ic(x)
t0=100;
u0 = t0;
% --------------------------------------------------------------
% end
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
global q
pl = 10 *cos(100*t);
ql = 1;
pr =ur-10;
qr = 0;
% end
I am getting the error message:
Warning: Failure at t=0.000000e+00.
Unable to meet integration tolerances
without reducing the step size below the
smallest value allowed (7.905050e-323) at
time t.
> In ode15s (line 668)
In pdepe (line 289)
In heat (line 20)
Warning: Time integration has failed.
Solution is available at requested time
points up to t=0.000000e+00.
> In pdepe (line 303)
In heat (line 20)
>>

Best Answer

I think the main problem is the value of L. Inf is not a good way to solve this problem. You should write largest positive floating-point number, realmax which is 1.7977e+308
L= realmax
If your code is right, it will gives you right answer
Related Question