So I have implemented central finite difference method for solving the 2D heat equation. When I leave all initial and boundary conditions as 0s, but apply an input uniform across the entire space or grid, I am only noticing temperature response at the boundary. I am not sure exactly what is causing this.

The code is here: https://colab.research.google.com/drive/1YCh_DDrw0uZPLvrWKU2hcw6lSe7cQiRS

But for a quick example of what this looks like:

enter image description here

Would really appreciate any help with looking at the code to see what's causing this. Is there any chance that my algorithm is unstable and I need to increase the discretization points or something?

  • 1
    $\begingroup$ I expect nobody is going to help, because your code requires asking for access. $\endgroup$ Jan 26 at 13:13
  • $\begingroup$ @JoschaFregin I just edited the access permission to anyone with the link $\endgroup$ Jan 26 at 15:38
  • $\begingroup$ In your code's odefunc function, you take T as an argument and then promptly set it ot the zero matrix. That's likely not what you intended. $\endgroup$ Jan 26 at 16:50
  • $\begingroup$ Okay, I corrected this, I also set the initial dTdt to be empty instead of zeros as well. This should be fine, correct? I am still seeing a weird plot now however if you look back at the code. It looks like maybe some of the ODE solutions for some of the points are diverging? $\endgroup$ Jan 26 at 16:59


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.