# Convergence and Stability of Explicit and Implicit Schemes in the Simulation of the Heat Equation
## 5 Results
### Discussion  
When performing simulations involving numerical solutions of partial differential equations, it is evident that, apart from rounding and series truncation errors (recall that finite difference expressions are derived from a Taylor series development up to second-order), there are the errors inherent in the limitations of fitting the physical model to accurately describe the real physical system and the limitations of the boundary conditions [47; 48; 49; 50]. The numerical time integration of the equations can be done explicitly or implicitly. In the former, its main advantage is the possibility to solve each time step, without the need to solve a system of equations where all the degrees of freedom are involved. Its disadvantage is the stability of the solutions, which in many cases leads to time steps that are too small to be efficient. On the contrary, implicit methods allow, under certain conditions, always stable time steps, whose size must be regulated only by criteria of precision and not of stability. In return, a system of equations involving all of its degrees of freedom must be solved, which makes the method costly and difficult to parallelize. The implicit method is the Crank-Nicholson method, it has an order of approximation equal to O (\(\Delta t^{2}+\Delta x^{2}\)). This method has the advantage of being unconditionally stable, i.e., the instability phenomenon does not appear in the solution that was seen for the explicit method. Figure 6 shows the temperature profile achieved under the conditions that introduced instability in the explicit scheme, that is, for \(\Delta x=5/13\) and \(\Delta t=0.5\). Figures 7-9 show the temperature profiles for the three discretization schemes presented in this work. CN outperforms the FTCS and BTCS schemes in terms of stability, convergence, and smoothness of the solutions. Table 1 compares the values achieved using the three schemes with the analytical solution. As can be seen in them and as mentioned, a better approximation is achieved for CN, compared to FTCS and BTCS. To study stability it is sufficient that the solutions of the differential equations do not present oscillations (are regular), even more so when the solutions are time-dependent. It is necessary to let the time-dependent variables evolve for a long time to verify that they do not present oscillations or irregular peaks, as can be seen in Figure 6. \begin{table}
\begin{tabular}{c c c c c} \hline \multirow{2}{*}{**X(m)**} & **Analytical** & **Numerical** & **Numerical** & **Numerical** \\  & **Temperature** & **Temperature** & **Temperature** & **Temperature** \\  & (\({}^{\circ}\)C) & **(FTCS) (\({}^{\circ}\)C)** & **(CN) (\({}^{\circ}\)C)** & **(BTCS) (\({}^{\circ}\)C)** \\ \hline
**0** & 50.00 & 50.00 & 50.00 & 50.00 \\
**0.5** & 125.10 & 124.76 & 125.21 & 120.23 \\
**1.0** & 154.32 & 154.79 & 154.02 & 150.33 \\
**1.5** & 175.22 & 176.43 & 175.13 & 169.07 \\
**2.0** & 202.37 & 204.84 & 202.34 & 199.97 \\
**2.5** & 225.12 & 225.75 & 225.18 & 221.86 \\
**3.0** & 167.35 & 166.13 & 167.27 & 163.45 \\ \hline \end{tabular}
\end{table} 
Table 1: Comparison of the exact (analytical) and approximate (numerical with forward difference, FTCS, CN, and BTCS) solution of the example. All the runs of the codes were elaborated with the three schemes. A mesh refinement was performed to verify the stability of the solutions. These discretization schemes can be extended to 2D and 3D problems. In some cases when the analytical solution is not known, one way to perform convergence is to take the numerical value of the first iteration of the program as the analytical solution and compare it with the numerical value of the second iteration. Then, the value of the second iteration is taken as the analytical solution and compared with the numerical value of the third iteration and so on. The convergence consists of checking how close the numerical solution obtained is to a known analytical solution.