Advanced multi-stage continuous distillation column simulator with NRTL thermodynamic model and optimized numerical solvers.
๐ Academic Origin: Originally developed as a student project at ENSGTI (รcole Nationale Supรฉrieure en Gรฉnie des Technologies Industrielles) in 2018. Refactored and modernized for production use with web interface and comprehensive documentation.
- MESH Equations: Material balance, Equilibrium, Summation, Heat balance
- NRTL Model: Non-Random Two-Liquid theory for non-ideal mixtures
- Vapor-Liquid Equilibrium: Activity coefficient calculations
- Enthalpy Calculations: Rigorous heat balances
- Newton-Raphson solver for non-linear systems
- Block Tridiagonal Matrix optimization (MRSL21 algorithm)
- Full Matrix solver (MRSL01) for comparison
- Analytical Jacobian with numerical perturbations
- High-Performance Backend: Fortran 90 for computational efficiency
- Python Wrapper: Easy integration with modern workflows
- Interactive Web UI: Streamlit-based interface with real-time visualization
- YAML Configuration: Human-readable simulation setup
# System requirements
- gfortran (GCC Fortran compiler)
- Python 3.8+
- uv (Python package manager)
- Make
# Check installations
gfortran --version
python3 --version
uv --version๐ฆ Using uv: This project uses uv for fast, reliable Python dependency management. Install with:
curl -LsSf https://astral.sh/uv/install.sh | sh(see docs/UV_GUIDE.md for details)
# Clone repository
git clone https://github.com/yourusername/distillation-column-simulator.git
cd distillation-column-simulator
# Install Python dependencies with uv (recommended)
uv sync
# Or use pip (alternative)
pip install -r frontend/requirements.txt
# Compile Fortran backend
cd backend
make
cd ..# With uv (recommended)
uv run streamlit run frontend/app.py
# Or activate venv first
source .venv/bin/activate # Linux/macOS
streamlit run frontend/app.pyThe application will open in your browser at http://localhost:8501
# Compile backend
cd backend && make
# Edit configuration
nano ../config/simulation_config.yaml
# Run simulation
./distillation
# Results saved to RESULTS.csvcolumn:
n_stages: 30
pressure_atm: 1.0
feeds:
- stage: 14
flow_rate: 1.0
composition:
acetone: 0.6
benzene: 0.3
chloroform: 0.1
thermal:
reboiler_duty: 21000.0 # cal/s
condenser_duty: 15000.0 # cal/sSystem Features:
- Ternary mixture with azeotrope (Acetone-Chloroform at 66/34%)
- Non-ideal behavior (NRTL model essential)
- 30 theoretical stages
- Typical convergence: ~1700 iterations, 50 seconds
distillation-simulator/
โโโ backend/ # Fortran computational engine
โ โโโ src/
โ โ โโโ modules/ # Global variable modules
โ โ โโโ thermodynamics/ # NRTL, equilibrium, enthalpies
โ โ โโโ solvers/ # MRSL01, MRSL21 linear solvers
โ โ โโโ utils/ # Utilities (norms, residuals)
โ โโโ Makefile # Build system
โ
โโโ python/ # Python wrapper package
โ โโโ distillation_wrapper/
โ โโโ fortran_interface.py
โ โโโ config_manager.py
โ โโโ data_processor.py
โ
โโโ frontend/ # Streamlit web application
โ โโโ app.py # Main application
โ โโโ components/ # UI components
โ
โโโ config/ # Configuration files
โ โโโ simulation_config.yaml
โ โโโ components.yaml
โ โโโ examples/
โ
โโโ docs/ # Documentation
โ โโโ scientific/ # Theory and equations
โ โโโ technical/ # API and usage
โ โโโ original/ # Original 2018 project docs
โ
โโโ results/ # Simulation outputs
- Thermodynamic Models - NRTL theory and implementation
- MESH Equations - Material and energy balances
- Numerical Methods - Newton-Raphson and matrix solvers
- Project Statement
- Full Technical Report (39 pages, French)
- See branch
archive/ensgti-2018for original unmodified code
cd backend
make clean && make# Python tests
pytest tests/python/
# Fortran validation
cd tests/fortran && ./run_validation.sh- Fortran: Fortran 90 standard, detailed comments
- Python: PEP 8, type hints, docstrings
- Git: Conventional commits
| Solver | Method | Avg. Time | Iterations | Memory |
|---|---|---|---|---|
| MRSL21 | Block Tridiagonal | ~20s | ~1700 | Low |
| MRSL01 | Full Matrix | ~26s | ~1700 | Higher |
Benchmark: 30 stages, acetone-benzene-chloroform, convergence 10โปโถ
Original Project (2018)
- Institution: ENSGTI Pau, France
- Course: Modรฉlisation des opรฉrations unitaires II
- Instructor: Pr. Frรฉdรฉric MARIAS
- Student: Younes AJEDDIG
Modernization (2025)
- Refactored for production use
- Added web interface
- Comprehensive documentation
- CI/CD integration
Contributions welcome! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see LICENSE file for details.
- ENSGTI for the original academic framework
- Frรฉdรฉric MARIAS for scientific guidance (2018)
- Open-source community for tools and libraries
Younes AJEDDIG
- GitHub: @yajeddig
- LinkedIn: Younes AJEDDIG
- Email: younes.ajeddig@gmail.com
Made with โค๏ธ for Process & Chemical Engineering