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 heateqnglobal rho cp kglobal q t0 w q0L=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 kc = rho*cp;f = k*DuDx;s = 0;% --------------------------------------------------------------% end
function u0 = pdex1ic(x)t0=100;u0 = t0;% --------------------------------------------------------------% endfunction [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)global qpl = 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 toleranceswithout reducing the step size below thesmallest value allowed (7.905050e-323) attime t. > In ode15s (line 668) In pdepe (line 289) In heat (line 20) Warning: Time integration has failed.Solution is available at requested timepoints up to t=0.000000e+00. > In pdepe (line 303) In heat (line 20) >>
Best Answer