0

I'm trying to solve a 1D-Heat Equation with Finite Difference Method in python.

The object I'm trying to depict has "Material A" with a high conductivity on the outside and a core of "Material B" with a small conductivity on the inside. I assigned the materials and their conductivity to the relative nodes with the help of an array.

After many steps, I would expect the resulting graph to show a dip in temperature where the "Material B" lies. The resulting graph shows a linear line though.

Resulting Graph

Is the heat equation applicable to different conductivities, or is my method flawed?

Heat Equation: $$\frac{\partial}{\partial t} T(x,t) - a \frac{\partial^2}{\partial x^2} T(x,t) = f(x,t).$$

FDM 1: $$\frac{\partial}{\partial t}T = \frac{T_{n,k+1} - T_{n,k}}{\Delta t}.$$

FDM 2: $$\frac{\partial^2}{\partial x^2}T = \frac{T_{n+1,k} - 2 \cdot T_{n,k} - T_{n-1,k}}{\Delta x^2}.$$

Added together and solved for T(k+1): $$T_{n,k+1} = m(T_{n+1,k} - 2 \cdot T_{n,k} + T_{n-1,k}) + T_{n,k} + \Delta t \cdot f_{n,k}.$$

EDIT 2:

I think my problem does not lie in solving a heat equation, but rather coming up with the correct formulation of the Boundary conditions. I tried to depict what I want to model in the graphic below.

enter image description here

My goal is to simulate the shown case in python with the help of the FDE Method.

So far my Boundary conditions where:

$$u(x_0, t) = 100 ~~ \text{and} ~~ u(x_3, t) = 20 $$

also $$ u(x,0) = 20$$

Within the program, I used these BC's and the homogenous heat equation in an FDM approach:

$$T_{n,k+1} = m(T_{n+1,k} - 2 \cdot T_{n,k} + T_{n-1,k}) + T_{n,k}$$

I thought that, if $k(x)$ just using:

$$ k(x) = k_1 ~~~for~~~ x_0 < x < x_1 ~~~and ~~~x_2 < x < x_3 $$ and $$ k(x) = k_2~~~ for~~~ x_1 < x < x_2 $$

I would have a realistic representation of my problem.

I tried to transfer Gert's question to mine but am not sure. If I understand correctly, I have to include two additional Boundary conditions. One for each interface at $x_1$ and $x_2$. I would then have to calculate 3 separate heat equations. One that depicts $x_0 ~~ to ~~ x_1$ and so forth.

Would that be a correct approach to solve my problem?

  • Tell us more about your finite difference setup. – Chet Miller Jan 02 '22 at 17:35
  • The Heat equation is valid, even if $\alpha=f(\vec{r})$ ($\vec{r}$ is the position vector), i.e. strongly anisotropic materials. Are you looking for the transient solution or the steady state solution? – Gert Jan 02 '22 at 17:37
  • Hello Gert, I'm looking for a transient solution. Although I think that the steady state solution should also not show a linear line. Am I correct in that assumption? – FabianM Jan 02 '22 at 17:54
  • I iterate the following equation: T[1:-1] = (T[1:-1] + sigma[1:-1] * (T[2:] - 2.0 * T[1:-1] + T[:-2])). Sigma is an array that contains the diffusivity of the materials. It looks like : [A,A,...,B,B,B,..,A,A,..] – FabianM Jan 02 '22 at 17:57
  • Let’s see the PDE you solved. – Chet Miller Jan 02 '22 at 18:03
  • Sorry I don't exactly know what you mean. Applying FDM to the heat equation gives me the equation I posted above. I will edit how I "solved" it in the post above. – FabianM Jan 02 '22 at 18:39
  • Am I correct in that assumption? It depends wehther your Fourier PDE is homogeneous or not. If $F(x,t)=0$ then the PDE reduces to a second order ODE and $\alpha$ drops out to: $T''(x)=0$, which solves to a line, for simple boundary conditions. – Gert Jan 02 '22 at 19:59
  • So do I understand correctly: It does not matter how many materials are defined, there will always be a straight line as shown in my post above? – FabianM Jan 02 '22 at 20:17
  • Your PDE is not valid for a material whose thermal conductivity varies with spatial position. It’s OK away from the interface between the two materials, but not across the interface. For a material whose conductivity varies with spatial position, the k has to be included within the outer spatial partial derivative. – Chet Miller Jan 02 '22 at 20:49
  • No, it depends on the boundary conditions of your PDE. For 'simple' (e.g. homogeneous) BCs you'll get a straight line, irrespective of $\alpha(x,t)$. So no matter how many layers, the line is independent of $\alpha$. But if the BCs are time dependent it becomes more complicated. – Gert Jan 02 '22 at 20:49
  • Incidentally, your graph doesn't show $t$ and you don't specify $f(x,t)$. Your problem is posed incompletely... – Gert Jan 02 '22 at 20:50
  • 1
    Also, Chet Miller solved a problem like yours in one of my questions: https://physics.stackexchange.com/questions/286001/heating-transient-of-a-composite-rod Chet and me are the 'resident Heat equation nutters'. ;-) – Gert Jan 02 '22 at 20:58
  • Thank you so much for your answers so far. I looked through your question and tried to apply it to my problem. I posted an edit in which I hope to illustrate my problem further. – FabianM Jan 04 '22 at 15:26

0 Answers0