Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: pdepe variable initial and boundary conditions
Replies: 3   Last Post: Dec 17, 2012 2:55 AM

 Messages: [ Previous | Next ]
 Ediz Batmaz Posts: 3 Registered: 10/18/12
pdepe variable initial and boundary conditions
Posted: Dec 10, 2012 2:38 AM

Hello,

I am trying to solve a 1D heat transfer equation in spherical coordinates using the pdepe function. For this particular problem, the initial temperature of the sphere and the ambient temperature are not constant values. The initial condition is a vector column with values representing the temperature values of the sphere at x values corresponding to the mesh points identified for the pdepe function. And, the ambient temperature is a variable that is captured experimentally for all t values throughout the experiment.

I am not clear about how to define the initial condition and boundary value in this case. For this specific case, the size of the initial condition vector is the same as the size of the x vector and the size of the ambient temperature vector is the same as the size of the t vector (which is defined elsewhere, but used in this function). Here is my code so far:

function u = sphere1DPC (h, t)

%This function is used as a function handle to a lsqcurvefit function...
%to solve for convective heat transfer coefficient -h- based on the...
%experimental data gathered at the center of the sphere.

m = 2;

x = linspace(0,0.00635,20)';

%Material variables:
rho = 1200;
Cp = 1260;
k = 0.25;

%Temperature variables
Tini = evalin('base', 'Tini');
Tinf = evalin('base', 'Tinf');
PureetempC = evalin('base', 'PureetempC');

sol = pdepe(m, @pdespherepde, @pdesphereic, @pdespherebc, x, t);

u = sol(:, 1, 1);

function [c, f, s] = pdespherepde(x, t, u, DuDx)
c = rho*Cp/k;
f = DuDx;
s = 0;
end

function u0 = pdesphereic (x)
for x=1:20
u0=Tini([x]);
end
% This is how I defined the initial condition but I am not sure if this is
% the right approach. In a case where the initial temperature is a constant
% it would have been identified as u0 = Tini;
end

function [pl, ql, pr, qr] = pdespherebc(xl, ul, xr, ur, t)
for t=1:385
% FYI, the t vector identified for the main function above is not the same as the t
% variable specified in the above line and does include decimal values.
pr = h*(ur - PureetempC([t]));
qr = k;
pl = 0;
ql = 0;
end
% Again, I am not sure if I have used the proper notation to characterize the
% the boundary condition.
end

end

Please advise if I need to make any changes to this code as the results I am getting is not making too much sense.

Regards,

Ediz.

Date Subject Author
12/10/12 Ediz Batmaz
12/10/12 Torsten
12/17/12 Ediz Batmaz
12/17/12 Torsten