This Python project focuses on solving equilibrium temperature distributions on a 2D grid using linear algebraic techniques, specifically Jacobi iteration and matrix inversion. The project is structured into several modules to enhance readability, modularity, and ease of understanding.
- The main script orchestrates the execution of the project. It sets up problem parameters, such as grid size and boundary temperatures, and then calls the
solve_temperature_equation
function. Finally, it visualizes the temperature distribution using theplot_temperature_distribution
function.
- Contains the core functions for solving linear systems and calculating solutions:
jacobi_iteration
: Performs Jacobi iteration to solve a linear system.calculate_inverse_solution
: Computes the solution vector using matrix inversion.- Example usage of these functions is demonstrated with a sample linear system.
- Provides a function (
plot_temperature_distribution
) to visualize the temperature distribution on a 2D grid using matplotlib.
- Includes a function (
calculate_inverse_solution
) that calculates the solution vector using matrix inversion.
- Defines functions to generate the coefficient matrix and right-hand side vector for the temperature problem:
generate_coefficient_matrix
: Creates the coefficient matrix and right-hand side vector.solve_temperature_equation
: Solves the temperature equation using Jacobi iteration (or matrix inversion).
To run the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/salastro/ETD-LA.git cd ETD-LA
-
Install dependencies:
poetry install
-
Run the
main.py
script:poetry run src/etd_la/main.py [-h] grid_size left_boundary_temp up_boundary_temp right_boundary_temp down_boundary_temp {2d,3d,2d-animation,3d-animation}
This will execute the example problem, solve the temperature equation, and display the resulting temperature distribution.
- NumPy: For numerical operations and linear algebra.
- Matplotlib: For plotting the temperature distribution.
If you wish to contribute to this project, please follow the guidelines outlined in the CONTRIBUTING.md file.
This project is licensed under the MIT License - see the LICENSE file for details.