0
$\begingroup$

I'm trying to solve 2nd order differetntial equation of heat transfer-type in a finite system x<0,L>, in particular:

eq = D[T[x, t], t] - k*D[T[x, t], {x, 2}] == 0;

(for simplicity, I assume hereafter k=1 and L=1). The system is attached to semi-infinite source of power 1 for x(-infty,0), while the initial 'temperature' for x<0,1) is 0. This gives initial condition for the equation in piecewise form:

T[x, 0] == Piecewise[{{1, x < 0}, {0, x >= 0}}]

Im also assuming Neumann boundary conditions: 1) 'heat' flux into the system is proportional to the temperature gradient between the source and the system:

Derivative[1, 0][T][0., t] == (T[0., T] - 1)

and 2) there is no 'heat' loss on the second boundary of the system:

Derivative[1, 0][T][1, t] == 0}

Merging all the elements I got a code:

sol = NDSolve[{eq,
T[x, 0] == Piecewise[{{1, x < 0}, {0, x >= 0}}],
Derivative[1, 0][T][0., t] == (T[0., t] - 1),
Derivative[1, 0][T][1, t] == 0},
T, {x, 0, 1}, {t, 0, 1}]
Plot3D[Evaluate[T[x, t] /. sol], {x, 0, 1}, {t, 0, 1}]

When I ran the code Mathematica (v8.0) sent me a warning about inconsistency of initial/boundary conditions - I assume I messed something with the behavior at x=0. However, I got a plot - not exactly what I want (T(x,t)=0). Then I've changed the initial conditions to

T[x, 0] == Piecewise[{{1, x <= 0}, {0, x > 0}}]

to enforce heat flux through the x=0. Once again I got the warning and a plot - this time I can see some 'temperature' distributions in the system, but the result seems to be bad, since the inconsistency of the initial/boundary conditions and also non-physical results (T>1, while it cannot be higher that the temperature of the source T=1).

Can someone help me to overcome the problem with the boundary/initial conditions? Im using Mathematica 8, so I cannot use NeumannValue function.

$\endgroup$
  • $\begingroup$ your IC says that T is zero everywhere. Then your left BC says that for all time, derivative of T w.r.t. x at left edge is equal to T at left edge minus 1. But derivative of T at left edge is zero, since T=0 there and T=0 also there. Hence you are saying that 0 = 0 -1 or 0=-1 and that is why I think Mathematica complained. Since everything is zero, and since there is no source, the solution is zero also. $\endgroup$ – Nasser Aug 13 at 12:01
  • $\begingroup$ You also have a typo T[0., T] should be T[0, t], And no need to write 0., you can just write an exact zero 0 $\endgroup$ – Nasser Aug 13 at 12:11
  • $\begingroup$ Dear Nasser, sorry for the typo, however it is not present in the final code. Thanks for 0. ->0. Still I dont know how to fight against these boundary/initial conditions. Since the initial c. states that T[x, 0] == Piecewise[{{1, x < 0}, {0, x >= 0}}], I assume T is not zero everywhere, just for x>0. The problem is I dont know how to properly state the boundary condition at x=0 (initially 0 + flux proportional to the temperature difference) $\endgroup$ – PwR Aug 13 at 12:16
  • $\begingroup$ @PwR What result do you want to get? $\endgroup$ – Alex Trounev Aug 13 at 16:57
  • $\begingroup$ Hi Alex, a simple plot (with physically plausible result) is just enough for now, thank you :) Im really looking for idea of merging ibc's for heat transfer problems $\endgroup$ – PwR Aug 13 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.