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:
HE1.mp4
HE.2.mp4
HE.3.mp4
HE.4.mp4
HE.5.mp4
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.
- 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.
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.
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.
To run the simulation, follow these steps:
- Clone the repository:
git clone https://github.com/colingalbraith/HeatEquation.git