Finite difference for variable conductivity I'm trying to discretize a portion of the heat equation for a sphere and for a cylinder where: $r$ = radius, $T$ = temperature, and $k$ = thermal conductivity. 
for the cylinder shape:
$$\frac{1}{r}\frac{\partial}{\partial r}(k \, r \frac{\partial T}{\partial r})$$
for the sphere shape:
$$\frac{1}{r^2}\frac{\partial}{\partial r}(k \, r^2 \frac{\partial T}{\partial r})$$
where $k$ is temperature dependent, it varies with temperature.
Most of the literature that I have read deals with the heat equation for a slab with the term $\frac{\partial}{\partial x}(k\frac{\partial T}{\partial x})$ and the finite difference solution for this is readily available.
Is it possible to discretize the term for cylinders and spheres using the finite difference method?  If so, any suggestions on how to accomplish this?
Note that I'm using the central differences approximation for the derivatives.
 A: I am assuming you have a table or function to give you $\frac{\mathrm{d}k}{\mathrm{d}T}$ at given values of $T$.
For
$$
\frac1r\frac{\partial}{\partial r}\left(kr\frac{\partial T}{\partial r}\right)
=\frac{\mathrm{d}k}{\mathrm{d}T}\left(\frac{\partial T}{\partial r}\right)^2+\frac{k}{r}\frac{\partial T}{\partial r}+k\frac{\partial^2T}{\partial r^2}\tag{1}
$$
if $\Delta r$ is constant, you can try
$$
\frac{\mathrm{d}k}{\mathrm{d}T}(T_j)\frac{\left(T_{j+1}-T_{j-1}\right)^2}{4\Delta r^2}+\frac{k}{2r_j\Delta r}\left(T_{j+1}-T_{j-1}\right)+\frac{k}{\Delta r^2}(T_{j+1}-2T_j+T_{j-1})\tag{2}
$$
as a discrete approximation of the first expression.
For
$$
\frac1{r^2}\frac{\partial}{\partial r}\left(kr^2\frac{\partial T}{\partial r}\right)
=\frac{\mathrm{d}k}{\mathrm{d}T}\left(\frac{\partial T}{\partial r}\right)^2+\frac{2k}{r}\frac{\partial T}{\partial r}+k\frac{\partial^2T}{\partial r^2}\tag{3}
$$
if $\Delta r$ is constant, you can try
$$
\frac{\mathrm{d}k}{\mathrm{d}T}(T_j)\frac{\left(T_{j+1}-T_{j-1}\right)^2}{4\Delta r^2}+\frac k{r_j\Delta r}\left(T_{j+1}-T_{j-1}\right)+\frac{k}{\Delta r^2}(T_{j+1}-2T_j+T_{j-1})\tag{4}
$$
as a discrete approximation of the first expression.
Note that the only difference between $(2)$ and $(4)$ is a factor of $2$ in the middle term.
