Skip to content

A Numerical solution to the 1D and 2D heat equation, with Neumann boundary conditions.

Notifications You must be signed in to change notification settings

colingalbraith/HeatEquation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heat Equation Simulation with Neumann Boundary Conditions

This simulation models heat conduction through a medium using the heat equation with Neumann boundary conditions. Below are some simulations with a constant forcing term in various locations:

Chess Board:

HE1.mp4

Grid of Dots:

HE.2.mp4

Random:

HE.3.mp4

Center:

HE.4.mp4

Boundary:

HE.5.mp4

Technical Overview

Neumann Boundary Conditions

The Neumann boundary condition imposes that the gradient (or flux) of the temperature at the boundaries of the domain is zero. Mathematically, this means:

  • ( \frac{\partial u}{\partial x} = 0 ) at the boundary for 1D.
  • ( \frac{\partial u}{\partial x} = 0 ) and ( \frac{\partial u}{\partial y} = 0 ) at the boundary for 2D.

Simulation Parameters

  • Thermal Diffusivity (a): Represents the heat diffusion coefficient. Higher values mean heat spreads faster through the medium.
  • Domain Length (length): The size of the domain (in mm) through which heat is conducted.
  • Time (time): The total duration (in seconds) for which the simulation runs.
  • Nodes (nodes): The number of discrete points in the simulation. Increasing the number of nodes improves accuracy but increases computation time.
  • Time Step (dt): Calculated to ensure stability in the simulation. Derived from the Courant-Friedrichs-Lewy (CFL) condition for numerical stability.
  • Forcing Term (Q): Represents a constant heat source added to the center of the domain to simulate external heating.

1D and 2D Simulations

The program simulates the heat equation in both 1D and 2D:

  • 1D Simulation: Models a single rod where heat is applied at the center and propagates outward, with insulated ends.
  • 2D Simulation: Models a flat plate where heat is applied at the center, and the temperature distribution evolves over time across the entire plate.

In both simulations, heat is initially distributed uniformly at 10°C. The forcing term (Q) applies heat to the center of the domain at each time step, raising the temperature locally.

Visualizing the Simulation

The program visualizes the temperature distribution as it evolves over time. The plots are updated in real-time, showing:

  • 1D Simulation: A line plot that tracks temperature distribution along the rod over time.
  • 2D Simulation: A heatmap that tracks temperature distribution over the plate.

Running the Simulation

To run the simulation, follow these steps:

  1. Clone the repository:
    git clone https://github.com/colingalbraith/HeatEquation.git

About

A Numerical solution to the 1D and 2D heat equation, with Neumann boundary conditions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages