sábado, 30 de setembro de 2023

2D steady-state heat diffusion using Python

Ordinary Differential Equations (ODEs) and Partial Differential Equations (PDEs) are part of a diverse range of physical phenomena. In engineering, they can be found in problems involving vibration, fluid mechanics, heat transfer, among others.

Simplifying the Energy Equation [1] for a steady-state 2D heat diffusion gives us the following PDE, which can be solved analitically:

\[\frac{\partial^{2}T(x, y)}{\partial x^{2}}+\frac{\partial^{2}T(x, y)}{\partial y^{2}}=0\]

Consider a rectangular plate with thermal conductivity given by "k", with length equal to "a", width equal to "b" and assume the following boundary conditions:

\[\left\{\begin{matrix}
 \\T(0,\space y)=0
 \\T(a,\space y)=0
 \\T(x,\space 0)=0
 \\-k\frac{\partial T(x,\space b)}{\partial y}=q_{in}\space if \space 0<x<\tfrac{a}{2}
\\-k\frac{\partial T(x, \space b)}{\partial y}=q_{out}\space if \space \tfrac{a}{2}<x<a
\end{matrix}\right.\]

Solving the PDE by the method of separation of variables and applying the Sturm-Liouville problem will lead to the following final solution considering the boundary conditions aforementioned:

\[T(x,\space y)=\sum_{n=1}^{\infty}C_{n}\sin \left ( \frac{n\pi x}{a} \right )\sinh\left ( \frac{n \pi y}{b} \right )\]

Where:

\[C_{n}=\frac{2}{n\pi\cosh\left ( \frac{n\pi x}{a} \right )}\left [ \int_{0}^{\frac{a}{2}}-q_{in}\sin\left (\frac{n\pi x}{a} \right )dx+\int_{\frac{a}{2}}^{a}-q_{out}\sin\left ( \frac{n\pi x}{a} \right )dx \right ]\]

Nowadays no one would dare to solve it by using a pen and a paper. Instead, we can take advantage of the computers to calculate approximate solutions using a certain number of iterations in the summation.

One great exercise I made in the past when learning Python was to implement this solution using this very friendly programming language. You can check the code in my repository on GitHub.

The boundary conditions considered in this solution result in this very cool temperature distribution presented in Figure 1.

 

Figure 1 - Temperature distribution of the plate.

More Python codes solving engineering problems related to heat transfer and fluid mechanics are going to show up in this blog. Stay tuned.

[1] Prof. Suman Chakraborty, Energy Equation. Department of Mechanical Engineering, IIT Kharagpur. Available at: <https://www.youtube.com/watch?v=k4zlxfUeNbE>. Accessed: 01 October 2023.

domingo, 12 de março de 2023

Final solution if you can't open Windows Settings in Windows 10

I had this issue some weeks ago and I have seen plenty of possible solutions on the internet. Some of them even guide you through the Windows register.

In my case, the problem was caused by a faulty installation of a Windows Update (in my case it was the update KB5022906).

If you have this problem and tried several solutions without success, here's one more for you to try:

  1. Go to the Microsoft Update Catalog (https://www.catalog.update.microsoft.com/Home.aspx)
  2. Search for the Windows Update that you faced the problem by its KB reference.
  3. Run the Microsoft Installer file downloaded.
If you have a similar issue as me, this should solver this problem and after the Windows Update installation you'll be able to open again the Windows Settings.