If I want to calculate steady temperature distribution on a one-dimensional stick, and I need to consider both the heat radiation and heat transfer, then my equation will be in the form: $$ \frac{\partial ^2 T}{\partial x^2}=A(T^4-T_{env}^4) + B(T-T_{env}). $$

$T_{env}$ is the environment temperature which varies at different places.

Is there any algorithm that can solve this kind of equation numerically? Most of numerical algorithms focus on equation like $H\phi=a\phi$.


1 Answer 1


Suppose you have 5 cells with 1 ghost cell (related to your particular boundary conditions, whatever they may be) on either side. In this case, you can write your steady-state heat equation as \begin{align} T_0-2T_1+T_2 &= dx^2\,f(T_1)\\ T_1-2T_2+T_3 &= dx^2\,f(T_2)\\ T_2-2T_3+T_4 &= dx^2\,f(T_3)\tag{1}\\ T_3-2T_4+T_5 &= dx^2\,f(T_4)\\ T_4-2T_5+T_6 &= dx^2\,f(T_5)\\ \end{align} where $$ f(T_i)=A\left(T_i^4-T_{ext}^4\right) + B\left(T_i-T_{ext}\right)\tag{2} $$ Equation (1) can be expressed as the matrix operation $$ \left(\begin{array}{ccccc}1 & -2 & 1 & 0 & 0 &0&0\\ 0 & 1 & -2 & 1 & 0 &0&0\\ 0 & 0 & 1 & -2 & 1 &0&0\\ 0& 0 & 0 & 1 & -2 & 1 &0\\ 0&0& 0 & 0 & 1 & -2 & 1 \\ \end{array}\right)\left(\begin{array}{c}T_0\\T_1\\T_2\\T_3\\T_4\\T_5\\T_6\end{array}\right)=dx^2\left(\begin{array}{c}f(T_0)\\f(T_1)\\f(T_2)\\f(T_3)\\f(T_4)\\f(T_5)\\f(T_6)\end{array}\right) $$ This means that your equation really takes the form, $$ \mathbb A\mathbf T=\mathbf b $$ where $\mathbb A$ is a tridiagonal matrix, $\mathbf T$ are your temperatures and $\mathbf b=f(\mathbf T)$ a vector of Equation (2). This is effectively a system of linear equations.

Thus, you want to look at iterative solver methods such as

Note that (a) this is an incomplete list and (b) each of these, as well as the others not mentioned, have its downsides and upsides. You'll likely want to spend some time looking at each one to choose the optimal one for you.

  • $\begingroup$ I don't think the matrix solving part is particularly relevant here (just use a standard library). On the other hand, you completely skip over boundary conditions, which is important from a physical point of view. $\endgroup$
    – Bernhard
    Dec 8, 2014 at 18:00
  • $\begingroup$ @Bernhard: (a) OP requested the numerical methods so I listed them, it's not our goal/duty to say which library is best. (b) debatable, the ghost cells are usually employed for boundary conditions (note that OP never mentioned anything about BCs, so how can I comment with non-existent information?). $\endgroup$
    – Kyle Kanos
    Dec 8, 2014 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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