<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Samwel Ngusa on Medium]]></title>
        <description><![CDATA[Stories by Samwel Ngusa on Medium]]></description>
        <link>https://medium.com/@ngusadeep?source=rss-00239a1cdd35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mKGIooM3RZ5a3tDk2_gWnA@2x.jpeg</url>
            <title>Stories by Samwel Ngusa on Medium</title>
            <link>https://medium.com/@ngusadeep?source=rss-00239a1cdd35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:16:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ngusadeep/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Heat Diffusion with Physics-Informed Neural Networks]]></title>
            <link>https://medium.com/@ngusadeep/heat-diffusion-with-physics-informed-neural-networks-e035f6a95466?source=rss-00239a1cdd35------2</link>
            <guid isPermaLink="false">https://medium.com/p/e035f6a95466</guid>
            <category><![CDATA[thermodynamics]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[neural-networks]]></category>
            <dc:creator><![CDATA[Samwel Ngusa]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 09:17:13 GMT</pubDate>
            <atom:updated>2026-02-05T09:20:37.828Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGVVin-fAvcuFM_40fZtUg.png" /></figure><p>Heat is everywhere in engines, buildings, electronics, and even our bodies. Understanding how it moves through materials is a classic problem in physics and engineering. Traditionally, scientists use numerical methods like finite differences or finite elements to simulate heat flow. But these methods can be computationally expensive, especially for complex systems.</p><p>What if a neural network could <strong>learn heat diffusion directly from physics itself</strong>? That’s exactly what Physics-Informed Neural Networks (PINNs) do.</p><h3>What Are Physics-Informed Neural Networks (PINNs)?</h3><p>Neural networks usually learn from data. If you want a network to predict temperatures, you feed it thousands of examples of input (position and time) and output (temperature).</p><p>PINNs take a different approach: instead of relying on data, they <strong>embed the laws of physics directly into the network</strong>. For heat diffusion, the network is penalized whenever its predictions <strong>violate the heat equation</strong>. This way, the network learns the solution while respecting physics.</p><p>In other words:</p><ul><li><strong>Input:</strong> position (x) and time (t)</li><li><strong>Output:</strong> temperature (u(x,t))</li><li><strong>Loss function:</strong> combination of PDE residual, boundary conditions, and initial conditions</li></ul><p>The network doesn’t just memorize it <strong>learns a continuous function that obeys thermodynamics</strong>.</p><h3>The Heat Equation</h3><p>For a simple 1D rod, heat diffusion is governed by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/86/0*4QTaujASPJkx9Cfe" /></figure><p>Where:</p><ul><li>u(x,t) = temperature at position (x) and time (t)</li><li>α = thermal diffusivity</li><li>Boundary conditions specify the temperature at the ends of the rod</li><li>Initial conditions define the starting temperature</li></ul><p>PINNs approximate (u(x,t)) using a neural network:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/125/0*VCKLmGG7ulahcSIH" /></figure><h3>How the PINN Learns</h3><p>Instead of training on thousands of examples, we generate <strong>random collocation points</strong> in the space-time domain. At each point, the network is evaluated for:</p><p><strong>PDE residual:</strong> is the heat equation satisfied?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/158/0*Npa02n2GfDCgbG56" /></figure><p><strong>Boundary conditions:</strong> does the temperature match at the edges?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*FokVRKCrwdtUA2m_" /></figure><p><strong>Initial condition:</strong> does the temperature match the starting distribution?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/0*kjPY0FBh56iLWQtW" /></figure><p>The <strong>PDE residual loss</strong> is calculated as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/0*QJEZxfiMpLWjPS4W" /></figure><p>And the <strong>total loss function</strong> guiding the network is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/176/0*smNcBhwlVpBjFxmy" /></figure><p>Automatic differentiation computes derivatives of the network with respect to space and time, enabling the PDE residual to be evaluated efficiently.</p><h3>Why This Matters</h3><ul><li><strong>Continuous solution:</strong> PINNs produce smooth predictions over space and time, unlike traditional grid-based methods.</li><li><strong>Fewer data requirements:</strong> Physics, not data, supervises the learning.</li><li><strong>Inverse problems:</strong> PINNs can also estimate unknown parameters like thermal diffusivity.</li><li><strong>Real-world applications:</strong> energy systems, electronics cooling, climate modeling, material science.</li></ul><h3>From 1D to 2D and Beyond</h3><p>Starting with a 1D rod is straightforward, but PINNs scale naturally:</p><ul><li>2D plates or 3D solids</li><li>Complex geometries and heterogeneous materials</li><li>Learning unknown thermal properties</li><li>Combining physics with real sensor data</li></ul><h3>Visualizing the Results</h3><p>You can create stunning visualizations:</p><ul><li><strong>Heatmaps</strong> showing temperature distribution over a plate</li><li><strong>Line plots</strong> of temperature along the rod at different times</li><li><strong>Animations</strong> showing how heat propagates</li></ul><p>These visuals make PINNs intuitive, even for non-experts.</p><h3>Tools Used</h3><ul><li><strong>Python</strong> — main programming language</li><li><strong>PyTorch</strong> — deep learning framework</li><li><strong>NumPy &amp; Matplotlib</strong> — computation and visualization</li><li>Optional: <strong>GPU acceleration</strong> for faster training</li></ul><h3>Conclusion</h3><p>Physics-Informed Neural Networks offer a fresh way to solve classical problems. By combining the <strong>power of neural networks with the rigor of physics</strong>, they allow us to learn continuous solutions with fewer data and greater flexibility.</p><p>For heat diffusion, PINNs are not just an experiment — they’re a bridge between traditional numerical simulation and modern AI-driven modeling.</p><p>This project demonstrates how <strong>machine learning can respect the laws of nature</strong>, opening doors to applications in energy, engineering, and beyond.</p><h3>Acknowledgements</h3><p>I would like to thank the following sources and communities for inspiring and guiding this project:</p><ul><li><strong>Raissi, M., Perdikaris, P., &amp; Karniadakis, G. E. (2019)</strong> — for introducing Physics-Informed Neural Networks</li><li><strong>PyTorch community</strong> for excellent tools and tutorials on neural networks and automatic differentiation</li><li><strong>Medium authors and AI research bloggers</strong> who have shared accessible explanations of PINNs</li><li>Friends and mentors in computational physics and machine learning communities for discussion and feedback</li></ul><h3>References</h3><ol><li>Raissi, M., Perdikaris, P., &amp; Karniadakis, G. E. (2019). <em>Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations.</em> Journal of Computational Physics, 378, 686–707. <a href="https://doi.org/10.1016/j.jcp.2018.10.045">https://doi.org/10.1016/j.jcp.2018.10.045</a></li><li>Karniadakis, G. E., Kevrekidis, I. G., Lu, L., Perdikaris, P., Wang, S., &amp; Yang, L. (2021). <em>Physics-informed machine learning.</em> Nature Reviews Physics, 3, 422–440. <a href="https://doi.org/10.1038/s42254-021-00314-5">https://doi.org/10.1038/s42254-021-00314-5</a></li><li>Raissi, M., &amp; Karniadakis, G. E. (2018). <em>Hidden physics models: Machine learning of nonlinear partial differential equations.</em> Journal of Computational Physics, 357, 125–141. <a href="https://doi.org/10.1016/j.jcp.2017.11.039">https://doi.org/10.1016/j.jcp.2017.11.039</a></li><li>Goodfellow, I., Bengio, Y., &amp; Courville, A. (2016). <em>Deep Learning.</em> MIT Press. <a href="https://www.deeplearningbook.org/">https://www.deeplearningbook.org</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e035f6a95466" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>