Skip to content

Kandil2001/Rust-FVM-Heat-Conduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2D Finite Volume Heat Conduction Solver in Rust

Completed Release v1.0.0 Rust Finite Volume Method Rust CI MIT License Portfolio case study

A completed two-dimensional steady-state heat-conduction solver written in Rust using the cell-centered Finite Volume Method.

The project demonstrates the main numerical workflow directly: spatial discretization, boundary-condition treatment, iterative solution, convergence monitoring, structured output, and result visualization. The current stable snapshot is published as v1.0.0.

Finite-volume temperature field

Features

  • cell-centered Finite Volume Method
  • structured Cartesian mesh
  • steady-state two-dimensional heat conduction
  • fixed-temperature boundary conditions
  • Gauss-Seidel iterative solution
  • residual-based convergence monitoring
  • CSV export for post-processing
  • SVG temperature-field generation
  • no external numerical or plotting libraries
  • GitHub Actions build, execution, and output checks

Problem setup

The current case models heat conduction through a square plate. The west wall is heated, while the remaining walls are maintained at a lower fixed temperature.

Property Value
Domain 0.5 m × 0.5 m
Grid 80 × 80 control volumes
West wall temperature 400 K
East wall temperature 300 K
North wall temperature 300 K
South wall temperature 300 K
Thermal conductivity 1000 W/(m·K)
Plate thickness 0.01 m
Convergence tolerance 1.0e-6 K

The temperature difference produces a fully two-dimensional field inside the plate.

Numerical method

For steady heat conduction with constant thermal conductivity:

∇ · (k∇T) = 0

The equation is integrated over each control volume and written in finite-volume form:

aP TP = aE TE + aW TW + aN TN + aS TS + Su

The prescribed wall temperatures are introduced through finite-volume source terms. The algebraic equations are solved using Gauss-Seidel iteration until the maximum temperature change between consecutive iterations falls below the configured tolerance.

Repository structure

.
├── .github/
│   └── workflows/ci.yml
├── src/
│   └── main.rs
├── results/
│   ├── temperature.csv
│   ├── residuals.csv
│   ├── summary.txt
│   └── temperature.svg
├── Cargo.toml
├── Cargo.lock
├── CITATION.cff
├── LICENSE
└── README.md

Running the solver

Clone the repository and run the locked release build:

git clone https://github.com/Kandil2001/Rust-FVM-Heat-Conduction.git
cd Rust-FVM-Heat-Conduction
cargo run --release --locked

For GitHub Codespaces, install Rust first when cargo is unavailable:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
cargo run --release --locked

Automated verification

The Rust CI workflow runs on pushes and pull requests to main. It:

  1. installs the stable Rust toolchain
  2. checks the locked Cargo project
  3. builds the release binary
  4. runs the default heat-conduction case
  5. verifies that the four expected result files were generated

This confirms that the tagged implementation builds and completes its default workflow. It is a software execution check, not an independent physical validation study.

Generated output

Each successful run updates:

  • temperature.csv — temperature at every control-volume center
  • residuals.csv — convergence history
  • summary.txt — simulation setup and final solver values
  • temperature.svg — temperature-field visualization used in this README

The CSV files can be opened in Python, MATLAB, Excel, or another post-processing tool.

Scope and limitations

This completed project focuses on a clear and compact finite-volume treatment of one two-dimensional diffusion case. It exposes coefficient assembly, boundary source terms, iterative updates, convergence checks, and output generation without hiding the numerical steps behind an external CFD library.

The current scope is intentionally limited to:

  • steady conduction
  • constant material properties
  • a uniform structured grid
  • fixed-temperature boundaries
  • one Gauss-Seidel solver
  • one demonstration case

Validation against an independent analytical or numerical reference was not part of the completed baseline project. The output should therefore be treated as a numerical implementation demonstration rather than a formally validated research result.

Possible extensions

  • heat-flux and convection boundary conditions
  • internal heat generation
  • transient conduction
  • nonuniform grids
  • Jacobi and Successive Over-Relaxation comparisons
  • grid-refinement and independent validation studies
  • parallel implementations for larger cases

Release and citation

The first stable repository snapshot is v1.0.0. Use the metadata in CITATION.cff when citing the software.

Author

Ahmed Kandil — Portfolio · LinkedIn · ORCID

Released under the MIT License.

About

Completed dependency-free Rust finite-volume solver for two-dimensional steady heat conduction with residual monitoring and SVG output.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages