In this project, the goal is to simulate the heat distribution in a rod of a specified length. The simulation is performed using the heat equation.
-
Applying Heat to the Rod: First, heat is applied to the rod for a duration of 10 seconds. This heat is modeled using the following function:
$$𝑓(𝑥,𝑡) = 10𝑡 \times \sin\left(\frac{𝜋𝑥}{𝐿}\right)$$ -
Simulating Heat Distribution: After applying heat, the distribution of temperature in the rod is simulated up to a user-specified time using the heat equation.
To solve the heat equation, the method of separation of variables is used. We assume that the solution can be expressed as the product of two independent functions of the spatial variable (𝑥) and the time variable (𝑡):
By substituting this assumption into the heat equation and separating the variables, we obtain two ordinary differential equations:
where 𝜆 is a separation constant. These equations are solved as follows:
With the boundary conditions 𝑋(0) = 0 and 𝑋(𝐿) = 0, the solution is:
The solution to this equation is:
By combining the two solutions, the general solution to the heat equation is:
Using the initial condition
$𝐴_1 = 100$ -
$𝐴_𝑛 = 0$ for$𝑛 \neq 1$
Thus, the final solution to the heat equation is:
- Input Parameters: The thermal diffusivity (𝛼) and the length of the rod (𝐿) are obtained from the user.
- Discretizing the Rod: The rod is divided into small segments.
- Calculating Temperature: The temperature at each segment and at each time step is calculated using the heat equation.
- Graphical Representation: The temperature distribution in the rod is displayed graphically.
To run the simulation, you can download the project and execute either the index-en.html
file (for English) or the index-fa.html
file (for Persian). Alternatively, you can use the following links to run the simulation online without downloading any files:
This project was presented in an Engineering Mathematics class in Persian. The presentation PowerPoint file, named Presentation.pptx
, is also available.