Thermal conduction through 1D rod with changing thermal diffusivity?

I've been working with solving partial differential equations in 1D numerically using the finite difference scheme.

My case is for example this: I've got a rod that's insulated around the sides such that the 1D case makes sense to use, the right side of the rod is connected to something such that the temperature is a constant $T_1$ and the left side a constant $T_2$. (similar to step 3 in the link) If the thermal diffusivity is constant through the rod, then this problem is something I can find solved on the internet everywhere (using a finite difference scheme). But what if the thermal diffusivity is nonuniform, for instance, if the rod is split up into 2 equally big parts but with a different diffusivity for each part, i.e., they are made of two different materials.

Can I then simply make the thermal diffusivity a function of $x_i$, $a= a(x)$, in the equation? That is, write:

$$\frac{\partial u}{\partial t}= a(x)\frac{\partial^2 u}{\partial x^2}$$

$$\frac{\partial u}{\partial t}= a\frac{\partial^2 u}{\partial x^2}$$

If yes, why? If no, why not?

Note: my question is not of a programming nature, I know I can program that sure - my question is if it would make sense physically.

• You say, similar to step 3 in the link but provided no link. Dec 2, 2014 at 16:55

Typically, however, the spatially-dependent diffusion equation is written as $$\frac{\partial u}{\partial t}=\nabla\cdot\left(a\nabla u\right)$$ Or, in one dimension, \begin{align} \frac{\partial u}{\partial t}&=\frac{\partial}{\partial x}\left(a\frac{\partial u}{\partial x}\right)\\ &=\frac{\partial a}{\partial x}\frac{\partial u}{\partial x}+a\frac{\partial^2u}{\partial x^2} \end{align}
Other factors for deviations from constant thermal diffusivity would include density fluctuations (e.g., imperfect material), layered materials (e.g., an iron bar wrapped around steel), and asymmetric composite materials. Note also that if the diffusivity is dependent on temperature, $a=a(T)$, then it would implicitly be dependent on space as well, $a(T(x))$.