Skip to content

Analytical solution to the 1D heat equation with Dirichlet boundary conditions, visualizing temperature distribution over time in a rod. Built with NumPy and Matplotlib.

Notifications You must be signed in to change notification settings

aminomrani/Heat-equation-Fourier-series-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Heat Equation Solver using Fourier Series (1D)

This repository presents a numerical simulation of the one-dimensional heat conduction in a rod, based on the analytical solution of the heat equation using a Fourier series. The project is implemented in Python using NumPy and Matplotlib.


πŸ“˜ Description

This project simulates the temperature distribution T(x, t) in a one-dimensional rod of length L, given an initial temperature profile. The solution is based on the analytical solution of the 1D heat equation with Dirichlet boundary conditions (T=0 at both ends), using the classical Fourier sine series expansion.


πŸ” Governing Equation

The heat equation (1D) is given by:

$$ \frac{\partial T}{\partial t} = \alpha \frac{\partial^2 T}{\partial x^2} $$

With:

  • Initial condition: ( T(x, 0) = T_0 )
  • Boundary conditions: ( T(0, t) = T(L, t) = 0 )

The analytical solution using the Fourier sine series is implemented.


πŸ”’ Parameters

  • L = 1 : Length of the rod
  • T0 = 100 : Initial temperature of the rod
  • alpha = 0.01 : Thermal diffusivity
  • terms = 100 : Number of terms in Fourier series
  • x = np.linspace(0, L, 200)
  • t = 0 to 10 seconds with step 0.25

πŸ“ˆ Output

The result is a dynamic plot of the temperature distribution over time, showing how the rod cools down from its initial temperature distribution.

Example:

plot


πŸš€ Requirements

Install the required Python packages using:

pip install numpy matplotlib

About

Analytical solution to the 1D heat equation with Dirichlet boundary conditions, visualizing temperature distribution over time in a rod. Built with NumPy and Matplotlib.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published