2
$\begingroup$

This is the question I am trying to solve enter image description here

After fours hours of research and 61 attempts (just today) on how to do this, I'm asking for help. I've been in hospital and am now trying to catch up on lectures and unfortunately, although the Maths makes sense, the Mathematica does not.

This is the latest attempt and I really cannot find where I am going wrong.

NDSolve[{D[T[x, t], t] == 2.5*D[T[x, t], {x, 2}] + 10*Exp[-x^2],T[-2, t] == 22, (D[T[x, t], x] /. x -> 2) == 0}, T[x, t], {x, -2, 2}, {t, 0, 20}]

I am literally in tears typing this because I don't know what do anymore.

This is what it appears as in Mathematica

enter image description here

I assumed because I am given the flux, this is Neumann boundary conditions but the error is coming up about Dirichlet boundary conditions. What am I doing wrong and how do I go about fixing it?

Thank you in advance for your help.

$\endgroup$
  • 2
    $\begingroup$ If I add the initial condition then it works for me. I don't know what the second error message is complaining about, but I think the solution looks correct once I do that. $\endgroup$ – KraZug Jan 11 at 11:39
  • $\begingroup$ Yeah, I made the same observation. The error messages are really misleading. $\endgroup$ – Henrik Schumacher Jan 11 at 11:44
  • $\begingroup$ @KraZug Thank you! $\endgroup$ – Grace Jan 11 at 11:57
  • $\begingroup$ @HenrikSchumacher Thank you! $\endgroup$ – Grace Jan 11 at 11:57
  • $\begingroup$ why does the problem says the heat is open to flow through the right boundary then it says the flux is zero? flux zero means it is insulated on the right. If something is insulated, does this not mean heat does not flow? which book/page number did you get this problem from? $\endgroup$ – Nasser Jan 11 at 14:41
3
$\begingroup$

Everything works fine if you include the initial condition,

alpha = 2.5; 

HE = D[T[x, t], t] == alpha*D[T[x, t], {x, 2}] + 10*Exp[-x^2]

sol = NDSolve[{HE, T[x, 0] == 22, T[-2, t] == 22, (D[T[x, t], x] /. x -> 2) == 0}, 
  T, {x, -2, 2}, {t, 0, 20}]
$\endgroup$
  • $\begingroup$ Thank you, ever so much! $\endgroup$ – Grace Jan 11 at 11:56
  • $\begingroup$ @Grace My pleasure :) $\endgroup$ – zhk Jan 11 at 11:56

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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