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}$$
instead of 
$$\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. 
 A: The thermal diffusivity can indeed be spatially dependent--consider the case you present: an iron bar fixed to a cool copper bar with one end being heated, clearly there is a disjoint in the value at the joining point. Now extend that idea to say 100 alternating blocks of iron & copper and you have a nice clear spatially dependent coefficient.
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))$.
This Physics.SE post of mine discusses the steady-state situation of the heat equation. This Physics.SE post contains some information on solving the heat equation with the finite difference method, in case you have some trouble on the concept of the finite differencing. Computational Science has many questions on the heat equation that you can peruse as well.
