A comprehensive desktop application with 8 professional modules: Tafel, Galvanic, EIS, Pitting, Inhibitor, Prediction, Comparison, and Data Import.
Project description
โก CorroSim - Professional Corrosion Analysis Platform
A comprehensive desktop application with 8 professional modules: Tafel, Galvanic, EIS, Pitting, Inhibitor, Prediction, Comparison, and Data Import.
โจ Features
๐ฌ Tafel Polarization Analysis
- Automatic detection of current units (A, mA, ฮผA)
- Proper Tafel region identification (80-200 mV from Ecorr)
- Verified Butler-Volmer kinetics fitting
- Real-time visualization with Matplotlib
- Export plots as PNG or PDF
๐ฎ Lifetime Prediction
- Linear, Power Law, and Exponential degradation models
- Confidence band visualization
- Service life estimation with threshold detection
- Interactive parameter adjustment
๐ Sample Comparison
- Multi-sample database with SQLite storage
- Search and filter functionality
- Color-coded corrosion rate indicators
- Export to Excel for further analysis
๐ Data Import
- Support for Excel (.xlsx, .xls) and CSV files
- Automatic column detection
- Data preview with statistics
- Unit specification options
๐จ Professional UI
- Modern, responsive interface with PyQt6
- Custom splash screen with progress indicator
- Consistent styling with professional color theme
- Sidebar navigation with active state indicators
๐ฌ EIS Impedance Spectroscopy (NEW in v1.4.0)
- Weighted CNLS fitting with 4 circuit models
- Auto-Select Best Model (R/RQ/RW/RWQ)
- Nyquist, Bode, Residuals plots
- Kramers-Kronig validation
๐ณ๏ธ Pitting Corrosion Analyzer (NEW in v1.4.0)
- Cyclic polarization Epit/Erp detection
- Gumbel extreme value statistics
- ASTM G61 compliant analysis
๐งช Inhibitor Efficiency Calculator (NEW in v1.5.0)
- IE% from corrosion rates
- Langmuir & Freundlich isotherm fitting
- ฮGยฐ adsorption thermodynamics
- Synergy parameter analysis
๐ธ Screenshots
๐ฅ๏ธ Main Application
โก Tafel Analysis
๐ฎ Lifetime Prediction
๐ Sample Comparison
๐ฌ EIS Impedance Spectroscopy
๐ณ๏ธ Pitting Corrosion Analyzer
๐งช Inhibitor Efficiency Calculator
๐ Installation
Prerequisites
- Python 3.8 or higher
- pip package manager
Option 1: Install from PyPI (Recommended)
pip install corrosim
corrosim
To upgrade to the latest version:
pip install --upgrade corrosim
Option 2: Install from GitHub
git clone https://github.com/khadev/CorroSim.git
cd CorroSim
pip install -r requirements.txt
python run.py
Option 3: Install as Development Package
git clone https://github.com/khadev/CorroSim.git
cd CorroSim
pip install -e .
corrosim
Option 4: Direct pip from GitHub
pip install git+https://github.com/khadev/CorroSim.git
corrosim
๐ฆ Dependencies
txt PyQt6>=6.5.0 matplotlib>=3.7.0 numpy>=1.24.0 pandas>=2.0.0 scipy>=1.10.0 openpyxl>=3.1.0
๐งช Running Tests
python tests/test_tafel.py
Expected output:
โ Test data generation passed โ All accuracy checks passed!
๐ Usage Guide
1. Import Data
- Click ๐ Import in the sidebar
- Browse and select your Excel/CSV file
- Click Load Preview to verify data
- Enter sample name and select test type
- Specify current units (or use Auto-detect)
- Click Import to Database
2. Tafel Analysis
- Navigate to โก Tafel tab
- Click Load Data to retrieve imported data
- Verify current units and electrode area
- Click โก Run Tafel Analysis
- View results: Ecorr, Icorr, Corrosion Rate, Tafel slopes
- Export plot as PNG or PDF
3. Lifetime Prediction
- Go to ๐ฎ Prediction tab
- Select degradation model (Linear/Power Law/Exponential)
- Set initial corrosion rate and failure threshold
- Set analysis period
- Click ๐ฎ Calculate Prediction
- View predicted lifetime and degradation curve
4. Compare Samples
- Open ๐ Compare tab
- Search and filter samples by name
- View all analysis results in sortable table
- Color-coded CR values: Green (low), Yellow (medium), Red (high)
- Export data to Excel
5.๐ Galvanic Corrosion Simulator (NEW in v1.1.0)
- 14 metals database from ASTM G82 galvanic series
- Mixed potential theory calculations
- Cathode/Anode area ratio effect
- Real-time galvanic series bar chart
- Severity classification per NACE SP0775
- Engineering recommendations
6. ๐ฌ EIS Analysis
- Go to ๐ฌ EIS tab
- Select circuit model or use Auto-Select
- Click Generate Test Data or Import CSV
- Click Run Weighted CNLS Fit
- View Nyquist, Bode, Residuals plots
7. ๐ณ๏ธ Pitting Analysis
- Go to ๐ณ๏ธ Pitting tab
- Click Generate Test Data or Import CSV
- Click Analyze Pitting
- View Epit, Erp, hysteresis
8.๐งช Inhibitor Efficiency
- Go to ๐งช Inhibitor tab
- Enter CR values or use data table
- Click Auto-Fit Best Isotherm
- View IE%, ฮGยฐ, synergy analysis
๐๏ธ Project Structure
corrosim/
โโโ corrosim/ # Main package
โ โโโ __init__.py # Package initialization (v1.5.0)
โ โโโ main.py # Application entry point + splash screen
โ โโโ app.py # Main window controller (8 tabs)
โ โโโ theme.py # UI styling (light + dark themes)
โ โโโ database.py # SQLite database operations (CRUD)
โ โโโ tafel_engine.py # Tafel polarization analysis engine
โ โโโ splash_screen.py # Professional splash screen widget
โ โโโ engines/ # Analysis engines
โ โ โโโ __init__.py
โ โ โโโ galvanic_engine.py # Galvanic corrosion prediction (ASTM G82)
โ โ โโโ eis_engine.py # EIS impedance fitting (Weighted CNLS)
โ โ โโโ pitting_engine.py # Pitting corrosion analysis (ASTM G61)
โ โ โโโ inhibitor_engine.py # Inhibitor efficiency + adsorption isotherms
โ โโโ tabs/ # UI Tab modules (MVC pattern)
โ โ โโโ __init__.py
โ โ โโโ import_tab.py # Data import (Excel/CSV)
โ โ โโโ tafel_tab.py # Tafel analysis interface
โ โ โโโ prediction_tab.py # Lifetime prediction (3 models)
โ โ โโโ comparison_tab.py # Multi-sample comparison + export
โ โ โโโ galvanic_tab.py # Galvanic simulator (14 metals)
โ โ โโโ eis_tab.py # EIS spectroscopy (4 circuits)
โ โ โโโ pitting_tab.py # Pitting analyzer (cyclic polarization)
โ โ โโโ inhibitor_tab.py # Inhibitor efficiency + synergy
โ โโโ utils/ # Utility modules
โ โโโ __init__.py
โ โโโ constants.py # Physical/electrochemical constants
โโโ tests/ # Test suite
โ โโโ __init__.py
โ โโโ test_tafel.py # Tafel engine validation (R^2 > 0.999)
โโโ screenshots/ # Application screenshots
โโโ dist/ # Built packages for PyPI
โโโ requirements.txt # Python dependencies
โโโ setup.py # Package setup script (pip install)
โโโ run.py # Quick launcher (python run.py)
โโโ README.md # Full documentation
โโโ LICENSE # MIT License
โโโ .gitignore # Git ignore rules
๐ฌ Algorithm Verification
The Tafel engine has been validated using synthetic Butler-Volmer data:
| Parameter | Expected | Recovered | Error |
|---|---|---|---|
| Ecorr | -0.500 V | -0.502 V | 0.4% |
| Icorr | 10.0 ฮผA/cmยฒ | 9.5 ฮผA/cmยฒ | 5.0% |
| ฮฒa | 120 mV/dec | 118.1 mV/dec | 1.6% |
| ฮฒc | 120 mV/dec | 118.4 mV/dec | 1.3% |
| Rยฒ | โ | 0.9997 | โ |
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add feature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
Khaled Oukil
- GitHub: @khadev
- Email: oukil.khaled@gmail.com
๐ References
Electrochemical Methods
- Stern, M., & Geary, A. L. (1957). Electrochemical Polarization: A Theoretical Analysis of the Shape of Polarization Curves. Journal of the Electrochemical Society, 104(1), 56-63.
- Tafel, J. (1905). รber die Polarisation bei kathodischer Wasserstoffentwicklung. Zeitschrift fรผr Physikalische Chemie, 50(1), 641-712.
- Mansfeld, F. (1973). Tafel Slopes and Corrosion Rates from Polarization Resistance Measurements. Corrosion, 29(10), 397-402.
EIS Spectroscopy
- Barsoukov, E., & Macdonald, J. R. (2018). Impedance Spectroscopy: Theory, Experiment, and Applications (3rd ed.). Wiley.
- Boukamp, B. A. (1995). A Linear Kronig-Kramers Transform Test for Immittance Data Validation. Journal of the Electrochemical Society, 142(6), 1885-1894.
- Orazem, M. E., & Tribollet, B. (2017). Electrochemical Impedance Spectroscopy (2nd ed.). Wiley.
Galvanic Corrosion
- ASTM G82-98(2021) - Standard Guide for Development and Use of a Galvanic Series for Predicting Galvanic Corrosion Performance.
- Hack, H. P. (1988). Galvanic Corrosion. ASTM International.
Pitting Corrosion
- ASTM G61-86(2018) - Standard Test Method for Conducting Cyclic Potentiodynamic Polarization Measurements for Localized Corrosion Susceptibility.
- ASTM G46-21 - Standard Guide for Examination and Evaluation of Pitting Corrosion.
- Gumbel, E. J. (1958). Statistics of Extremes. Columbia University Press.
Corrosion Inhibitors
- Langmuir, I. (1918). The Adsorption of Gases on Plane Surfaces of Glass, Mica and Platinum. Journal of the American Chemical Society, 40(9), 1361-1403.
- Freundlich, H. (1906). รber die Adsorption in Lรถsungen. Zeitschrift fรผr Physikalische Chemie, 57(1), 385-470.
- Aramaki, K., & Hackerman, N. (1969). Inhibition Mechanism of Medium-Sized Polymethyleneimine. Journal of the Electrochemical Society, 116(5), 568-574.
Corrosion Rate Calculation
- ASTM G102-89(2015)e1 - Standard Practice for Calculation of Corrosion Rates and Related Information from Electrochemical Measurements.
- NACE SP0775-2013 - Preparation, Installation, Analysis, and Interpretation of Corrosion Coupons in Oilfield Operations.
Atmospheric Corrosion
- ISO 9223:2012 - Corrosion of Metals and Alloys โ Corrosivity of Atmospheres โ Classification, Determination and Estimation.
Software & Tools
- PyQt6 Documentation. Riverbank Computing. https://www.riverbankcomputing.com/static/Docs/PyQt6/
- Matplotlib: Hunter, J. D. (2007). Matplotlib: A 2D Graphics Environment. Computing in Science & Engineering, 9(3), 90-95.
- SciPy: Virtanen, P., et al. (2020). SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17, 261-272.
Built with โค๏ธ for the corrosion science community
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file corrosim-1.5.1.tar.gz.
File metadata
- Download URL: corrosim-1.5.1.tar.gz
- Upload date:
- Size: 51.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a44c743f5114495ac28d1d7631adb42a5aad9acca27c389c35300da4ef232c37
|
|
| MD5 |
548b20437cc42e3560b8a5a8c10d3b34
|
|
| BLAKE2b-256 |
957c6e3d402d0056f9130c9b64206c8986dadc6315bc64c0788ad0e2a1ff5a3f
|
File details
Details for the file corrosim-1.5.1-py3-none-any.whl.
File metadata
- Download URL: corrosim-1.5.1-py3-none-any.whl
- Upload date:
- Size: 56.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93c703c4696ce38d7cbd1a59470eee21af3cb089c2e2a12ff4095deae889a782
|
|
| MD5 |
49973b206dc10453c27363b3505cd8b3
|
|
| BLAKE2b-256 |
1597c8e7d9450aa2b9208f69f7ff7354e7406b623d738ff712fc3f4a28360a21
|