I am have trouble with what should be a fairly simple NDSolve operation for the unsteady state heat transfer in a rod. The rod starts off at 20oC, and its surface temperature is fixed at 37oC. I am fairly new to Mathematica, so I'm not sure what is going wrong! I keep getting the error `"Infinite expression 1/0. encountered."'
My code is:
a = 0.010
Cp = 2000
k = 0.1
rho = 900
alpha = k/(rho*Cp)
Tval[r_, t_] = NDSolve[{
(* PDE - 1D Radial Heat Equation *)
(1/r)*(D[(r*D[T[r, t], r]), r]) == (1/alpha)*D[T[r, t], t],
(* Boundary Conditions *)
T[a, t] == 37,
(D[T[r, t], r] /. r -> 0) == 0,
(* Initial Condition *)
T[r, 0] == 20},
(* Define Variables *)
T[r, t], {r, 0, a}, {t, 0, 1800}]
Plot[{Tval[r,0],Tval[r,100],Tval[r,200]},{r,0,a}]
If anyone can work out why I am getting division by zero that would be much appreciated!
0
by some small number, say 10^-4, as the inner boundary inr
, andNDSolve
will work. DefineTval[r_, t_] = T[r, t] /. Flatten@NDSolve[...
, andPlot
will work too. $\endgroup$T[a, t] == 37
andT[r, 0] == 20
together have the effect of assigningT[a, 0]
two different values, which could be a problem. $\endgroup$