Theory exercise 4

Fredrik Eikeland Fossan


Feb 26, 2019


Problem 1: Stationary temperature field in a square cross-section

Here we are going to find the stationary solution of the temperature field in a square beam cross-section. In the top and left side of the cross-section the temperature is known (Dirichlet boundary condition), and on the right and bottom side the derivative is known (Neumann boundary condition), see Figure 1.

Figure 1: Cross-section with boundary conditions

If we assume isotropic heat conduction we can write the stationary heat conduction equation as: $$ \begin{align} \frac{\partial^2T}{\partial x^2} + \frac{\partial^2T}{\partial y^2} = 0. \label{eq:heat} \end{align} $$

a) Write the general discretized version of \eqref{eq:heat}, using centered finite differences for a grid node that is not influenced by boundary conditions. Use equal spacing in x and y directions (\( \Delta x = \Delta y \)).

Answer.

$$ \begin{align} T_{i-1,j} + T_{i,j-1} - 4\,T_{i,j} + T_{i+1,j} + T_{i,j+1} = 0 \label{_auto1} \end{align} $$

b) Using \( \Delta x = \Delta y = \frac{1}{3} \) and ghost nodes for the Neumann boundary conditions (centered finite differences), write out the resulting discretized equations for all mesh nodes where the temperature is unknown. Draw a sketch of the corresponding grid (also including treatment of boundary conditions). Furthermore, write out the matrix \( \boldsymbol{A} \) and right hand side \( \boldsymbol{b} \) of the corresponding system of linear algebraic equations, \( \boldsymbol{A}\cdot \boldsymbol{T}=\boldsymbol{b} \), where \( \boldsymbol{T} \) is a vector holding the unknown temperatures. Number the components of \( \boldsymbol{T} \) by starting in the lower left part of the grid and increase index in the \( x \)-direction first.

Answer.

Figure 2: Sketch of discretization

$$ \begin{equation} \boldsymbol{A} = \left[\begin{matrix}-4 & 1 & 0 & 2 & 0 & 0 & 0 & 0 & 0\\1 & -4 & 1 & 0 & 2 & 0 & 0 & 0 & 0\\0 & 2 & -4 & 0 & 0 & 2 & 0 & 0 & 0\\1 & 0 & 0 & -4 & 1 & 0 & 1 & 0 & 0\\0 & 1 & 0 & 1 & -4 & 1 & 0 & 1 & 0\\0 & 0 & 1 & 0 & 2 & -4 & 0 & 0 & 1\\0 & 0 & 0 & 1 & 0 & 0 & -4 & 1 & 0\\0 & 0 & 0 & 0 & 1 & 0 & 1 & -4 & 1\\0 & 0 & 0 & 0 & 0 & 1 & 0 & 2 & -4\end{matrix}\right], \qquad \boldsymbol{b} = \left[\begin{matrix}-50\\0\\0\\-50\\0\\0\\-150\\-100\\-100\end{matrix}\right] \label{_auto2} \end{equation} $$

c) Now choose \( \Delta x = \Delta y = \frac{1}{N} \), where N may be chosen arbitrary, and briefly show/explain the pattern of the corresponding \( \boldsymbol{A} \) matrix; which diagonals are non-zero, and what pattern do they follow?

Answer.

  • Main diagonal: all (\( N \cdot N \)) elements are \( -4 \)
  • Super diagonal 1: all (\( N \cdot N - 1 \)) elements are \( 1 \). Exceptions:
    • Starting from python index \( N-1 \), every \( N \)-th element is \( 0 \)
  • Sub diagonal 1: all (\( N \cdot N - 1 \)) elements are \( 1 \). Exceptions:
    • Starting from python index \( N-2 \), every \( N \)-th element is \( 2 \)
    • Starting from python index \( N-1 \), every \( N \)-th element is \( 0 \)
  • Super diagonal N: all (\( N \cdot N - N \)) elements are \( 1 \). Exceptions:
    • The first N elements are \( 2 \)
  • Sub diagonal N: all (\( N \cdot N - N \)) elements are \( 1 \).