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.

  • $\begingroup$ For the cylinder, you can change variables as ${\large z = \ln\left(r\right)}$ before the discretization. For the sphere, ${\large z = {1 \over r}}$. $\endgroup$ – Felix Marin Sep 11 '13 at 23:42

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.

  • $\begingroup$ @Gavin: all I am doing is approximating the derivative with $\frac{T_{j+1}-T_{j-1}}{r_{j+1}-r_{j-1}}$ (centralized). The denominator is just $2\Delta r$. For the second derivative, I am using $\frac{T_{j+1}-2T_j+T_{j-1}}{\Delta r^2}$ (naturally centralized). This is probably mentioned in most texts on Finite Differences. $\endgroup$ – robjohn Sep 12 '13 at 0:40
  • $\begingroup$ Yeah I understand the centralized stuff for first and second order derivatives. The part that is confusing is when I have to work with mixed derivatives like the terms I mentioned in my question. $\endgroup$ – wigging Sep 12 '13 at 1:26
  • $\begingroup$ Actually, your solution seems to consider $k$ as a constant rather than it varying with temperature. I have been using the heat equation which considers constant $k$ but now I'm trying use the form with variable $k$. Please see the following which may explain this better: geowiss.uni-mainz.de/Dateien/Finite_Differerence_intro.pdf $\endgroup$ – wigging Sep 12 '13 at 1:34
  • $\begingroup$ @Gavin: I have incorporated varying $k$ into the equations above. $\endgroup$ – robjohn Sep 12 '13 at 2:32
  • $\begingroup$ Thank you! I will see about implementing these equations into to code. $\endgroup$ – wigging Sep 13 '13 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.