PDC Report
PDC Report
REPORT
Parallel Distribution and Computing
Group Members:
Hassan Riaz (F2021266408)
Section
V6
Code:
#include <iostream>
#include <cmath>
#include <vector>
#include <iomanip>
void calculateTemperature() {
double rodLength, queryTime, queryPoint;
const double T0 = 0.0;
const double dx = 0.01;
const double dt = 0.0001;
int main() {
int choice;
do {
cout << "\n=== Temperature Simulation Menu ===\n";
cout << "1. Calculate Temperature at a Specific Point and Time\n";
cout << "2. Exit\n";
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
calculateTemperature();
break;
case 2:
cout << "Exiting the program. Goodbye!\n";
break;
default:
cout << "Invalid choice. Please try again.\n";
}
} while (choice != 2);
return 0;
}
History and Background of the Code
The given code numerically solves the one-dimensional heat equation using the explicit finite
difference method (FDM). It is rooted in the principles of heat conduction, one of the earliest and
most studied phenomena in thermodynamics and mathematical physics. Below is the historical and
theoretical context of the code and the techniques it employs:
This equation describes how temperature evolves in a rod over time due to heat conduction.
---------------------------------------------------------------------------------------------------------------------------
3. Computational Advancements and Real-World Applications
Numerical Heat Transfer
• Numerical methods like the FDM became integral in fields such as:
o Engineering: Designing heat exchangers, insulation materials, and cooling systems.
o Geophysics: Modeling heat flow in the Earth's crust.
o Medical Physics: Simulating heat diffusion in biological tissues during thermal
therapies.
Modern Applications
• The simulation of temperature distribution is critical in fields like:
o Aerospace: Managing thermal stresses in spacecraft during reentry.
o Electronics: Ensuring effective heat dissipation in microprocessors.
o Material Science: Analyzing thermal properties of new materials.
Applications
The heat equation is pivotal in:
• Thermodynamics and heat transfer,
• Geophysics for modeling geothermal gradients,
• Biomedical applications like tissue heating during medical treatments,
• Engineering for analyzing heat in devices and systems.
Future Directions
1. Optimization:
o Use adaptive time-stepping to maintain stability while improving efficiency.
o Parallelize the algorithm for faster simulations on large grids.
2. Modeling Real-World Scenarios:
o Include variable thermal diffusivity or heat sources.
o Extend to two or three dimensions for more realistic applications.
3. Integration with Machine Learning:
o Combine numerical methods with ML to predict temperature distributions under
uncertain parameters.
4. Advanced Numerical Techniques:
o Transition to implicit or Crank-Nicolson methods for improved stability and accuracy.
o Incorporate FEM for irregular geometries or heterogeneous materials.
Conclusion
The code is a straightforward implementation of the explicit FDM for solving the one-dimensional
heat equation. While limited by its simplicity and stability constraints, it serves as a foundation for
understanding numerical heat transfer methods. The extensive body of literature on numerical
methods, ranging from FDM to FEM and spectral techniques, highlights the evolution and
applications of heat conduction modeling across diverse fields.