I am trying to calculate the heat transfer among a 1-D rod, with one end insulated while the right end is immersed in constant temperature surface T=0. Assume that the initial temperature of the rod is T=1. The rod length is 5. I set up the equation like this:
$$ \frac {\partial^2 u(x,t)}{\partial x^2}-\frac {\partial u(x,t)}{\partial t} = 0\\ u(x,0)=1\\ \frac {\partial u(5,t)}{\partial x} = 0\\ u(0,t)=0 $$
sol = NDSolve[{
eqn = D[u[t, x], t] - D[u[t, x], {x, 2}] == 0,
u[0, x] == 1,
u[t, 0] == 0,
(D[u[t, x], x] /. x -> 5) == 0
}, u, {t, 0, 50}, {x, 0, 5}]
Plot3D[Evaluate[u[t, x] /. %], {t, 0, 50}, {x, 0, 5},
PlotRange -> All]
Unfortunately, I got something like this:
NDSolve::ibcinc: Warning: boundary and initial conditions are inconsistent.
Can anyone help me with the boundary value problem?