-1

For a project I am assigned to solve the heat equation in a 2D environment in Python. To do this, I am using the Crank-Nicolson ADI scheme and so far things have been going smooth. I would also like to add that this is the first time that I have done numerical computing like this and I don't have a lot of experience with PDE's and finite difference methods.

However, problems start when I try to add a second material with a different thermal diffusivity. At the boundaries of the 2 materials, the temperature keeps rising and rising exponentially, but only at the boundaries (as if they are a heat source). Any other place in the domain functions fine and does not show this behaviour at all. Why does this happen and how can I stop it? Do I need to impose new boundary conditions on these boundaries, or can I just 'force' my way through this by calculating the temperature on the boundary and treating the two materials as independent domains?

sintetico
  • 3,513
  • 2
    What is your finite difference equation for matching the heat fluxes at the boundary? – Chet Miller Apr 12 '18 at 13:43
  • Currently the whole domain has fixed temperature boundary conditions at the edges of the (square) domain. I haven't implemented boundary conditions between the two materials because I thought the program could just calculate the temperature values, only with a different thermal diffusivity. I know there is such a thing as thermal resistance, but I wanted to add that later. I just cant understand why the boundaries between the materials get so 'hot'. – Jeroen Reurink Apr 12 '18 at 13:59
  • 1
    Like I said, what is the heat flux matching boundary condition between the two materials? – Chet Miller Apr 12 '18 at 14:38
  • Related: https://physics.stackexchange.com/q/107761/25301, https://physics.stackexchange.com/q/13996/25301, https://physics.stackexchange.com/q/137705/25301, etc – Kyle Kanos Apr 12 '18 at 18:08
  • Do you use a single domain, with a space-varying diffusivity, or two connected domains which share a common boundary? The answer would be quite different… – Nicolas Apr 12 '18 at 19:08
  • I use a single domain with space-varying diffusivity; the lower part of the domain has a high diffusivity and the upper part has a low diffusivity for example. My tridiagonal matrix with the diffusivity coëfficients reflects this. – Jeroen Reurink Apr 13 '18 at 07:46
  • So, if I understand correctly, the temperature value peaks at the position inside the grid where the diffusivity happens to change? Then to understand you should ask yourself the following questions : 1) is this temperature increase really exponential in time? 2) if this is the case, what is the characteristic time of that exponential? 2a) is it tied to the grid/time step? Then it's probably a numerical stability problem, and you should study the stability of your numerical scheme with space varying diffusivity 2b) is it tied to the diffusivity value(s)? – Nicolas Apr 13 '18 at 08:16
  • From a practical point of view, varying slowly (over a few grid points) the diffusivity (say, using sin instead of a step function) may help. – Nicolas Apr 13 '18 at 08:18
  • 3
    I'm voting to close this question as off-topic because it is about debugging code and not about a physics concept. – BioPhysicist Dec 18 '19 at 19:03

1 Answers1

0

The reason it got 'hot' is the interface between the two parts is not properly set. you cannot set a fixed temperature boundary condition on both parts. This "temperature" is calculated but not given. If you set a "guessed" temperature, the local temperature gradient will be unphysical. On one part, it will be a heat source or sink.

user115350
  • 2,018