A simple, terminal-based user interface (TUI) application for calculating thermodynamic properties of ideal gas processes (Isothermal, Isochoric, Isobaric, Adiabatic) and Carnot Engine efficiency. Built entirely in Rust using the ratatui and crossterm libraries.
-
Process Calculator: Calculate Heat (
$Q$ ), Work ($W$ ), and Change in Internal Energy ($\Delta U$ ) for:- Isothermal Process (
$\Delta T = 0$ ) - Isochoric Process (
$\Delta V = 0$ ) - Isobaric Process (
$\Delta P = 0$ ) - Adiabatic Process (
$Q = 0$ )
- Isothermal Process (
-
Carnot Engine Efficiency: Calculate the theoretical maximum efficiency (
$\eta$ ) of a heat engine based on hot ($T_H$ ) and cold ($T_C$ ) reservoir temperatures. - Interactive TUI: Navigate and input variables easily using the keyboard.
-
Input Validation: Checks for physical constraints like non-negative moles (
$n>0$ ) and positive Kelvin temperatures ($T>0$ ).
You need to have Rust and Cargo installed.
-
Clone the repository:
git clone [https://github.com/your-username/thermo-calc-tui.git](https://github.com/your-username/thermo-calc-tui.git) cd thermo-calc-tui -
Run the application:
cargo run
The TUI will launch in your terminal. Use the arrow keys,
Enter,Tab, andEsc/b(back) to navigate.
The core logic is structured around a ThermodynamicProcess trait, allowing easy extension for new processes.
models/: Defines the application state (App) and data structures (IdealGas,ThermoResult).thermo_processes.rs: Implements theThermodynamicProcesstrait for each of the four main processes.utilities.rs: Contains input parsing, validation, and the calculation triggering logic.main.rs: Handles terminal setup, the main event loop, and keyboard input processing.
Contributions are welcome! Feel free to open an issue or submit a pull request if you find a bug or have a suggestion for improvement.
This project is licensed under the MIT License. See the LICENSE file for details.