Skip to content

da578/thermo-calc-tui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚛️ Thermo-Calc-TUI

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.

✨ Features

  • 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$)
  • 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$).

⚙️ Installation & Usage

Prerequisites

You need to have Rust and Cargo installed.

Build and Run

  1. 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
  2. Run the application:

    cargo run

    The TUI will launch in your terminal. Use the arrow keys, Enter, Tab, and Esc/b (back) to navigate.

🛠️ Implementation Details

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 the ThermodynamicProcess trait 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.

🤝 Contributing

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.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A cross-platform, terminal-based calculator for ideal gas processes (Isothermal, Isobaric, etc.) and Carnot Engine efficiency, built with Rust and TUI/ratatui.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages