Could you help me please to solve following problem! I need to solve one-dimensional heat equation with Robin type boundary conditions. But Mathematica find only constant solution with no dependence on time and space coordinates. My code:

   D[T[x, t], t] - D[D[ T[x, t], x], x] == 0,
   (D[T[x, t], x] - (T[x, t] - 100) == 0) /. x -> 0, 
   (D[T[x, t], x] + (T[x, t] - 20) == 0) /. x -> 1, 
   T[x, 0] == 20
}, T, {x, 0, 1}, {t, 0, 1}]

Mathematica returns that temperature will be constant in all region: T[x,t]=20 (but in steady state solution we will have the liner low for the T(x)).

  • $\begingroup$ When trying to run your code, I get a warning, complaining that boundary and initial conditions are inconsistent. Do you see the same? Have you looked into that? $\endgroup$ – MarcoB Jul 9 '15 at 17:24
  • $\begingroup$ Are you sure of your boundary conditions? This example has Robin boundary conditions. (it is a link to a pdf file) $\endgroup$ – dearN Jul 9 '15 at 18:24
  • $\begingroup$ Thanks to MarcoB. I try to use good initial conditions (exponential low or Piecewise[] function), and it works now. $\endgroup$ – Yury Jul 10 '15 at 11:15
  • $\begingroup$ Yuri, I'm glad to hear you got it working. Would you please summarize your working solution as an answer? This way the question will be more valuable to other people experiencing similar problems. $\endgroup$ – MarcoB Jul 11 '15 at 3:27

Something like this:

NDSolve[{D[T[x, t], t] - D[D[T[x, t], x], x] == 
   NeumannValue[T[x, t] - 100, x == 0] - 
    NeumannValue[T[x, t] - 20, x == 1], T[x, 0] == 20
  }, T, {x, 0, 1}, {t, 0, 1}, 
 Method -> {"MethodOfLines", 
   "SpatialDiscretization" -> "FiniteElement"}]
  • $\begingroup$ Comment please, if I understand correctly: the method option you apply is due to the fact that the equation is time dependent, not because of the Robin condition. The Robin condition is treated automatically, right? $\endgroup$ – Alexei Boulbitch Nov 6 '15 at 10:46
  • $\begingroup$ Yes, this tells NDSolve to treat this as a time dependent problem with x as a spatial variable and t as time. Otherwise it tries to solve this as a purely spatial problems with both x and t as spatial coordinates. $\endgroup$ – user21 Nov 6 '15 at 12:26
  • $\begingroup$ @user21 I checked the two Neumann conditions -Derivative[1, 0][T][0, t] == T[0, t] - 100 and Derivative[1, 0][T][1, t] == T[1, t] - 20 in your answer. The solution only fullfills the first . What could be the reason? Thanks! $\endgroup$ – Ulrich Neumann Sep 20 '19 at 8:22
  • $\begingroup$ @UlrichNeumann, a missing - sign in your second equation? $\endgroup$ – user21 Sep 20 '19 at 8:28
  • $\begingroup$ @user21 Thanks. I assumed a positiv flux in x-direction at x==1 and a negativ flux at x==0, this assumption seems to be wrong. $\endgroup$ – Ulrich Neumann Sep 20 '19 at 8:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.