# Finite Difference Method Heat Equation problems at boundary between two materials

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?

• 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
• Like I said, what is the heat flux matching boundary condition between the two materials? – Chet Miller Apr 12 '18 at 14:38
• – Kyle Kanos Apr 12 '18 at 18:08
• 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