Physics-Guided Temporal Transformer for CO2 Corrosion with SHAP Case study: Asaluyeh SPGC Complex, Iran
- Department of Computer Engineering, Sar.C., Islamic Azad University, Sari, Iran
- Department of Industrial and Computer Engineering, Mazandaran University of Science and Technology, Babol, Iran
Received: 2025-11-11
Revised: 2025-12-20
Accepted: 2025-01-21
Published in Issue 2026-03-31
Copyright (c) 2026 Afshin Mohammadi, Ebrahim Akbari, Homayun Motameni, Faraein Aeini (Author)

This work is licensed under a Creative Commons Attribution 4.0 International License.
How to Cite
PDF views: 27
Abstract
The structural integrity of the oil and gas industry is at high risk due to CO₂-induced corrosion; consequently, practical, explainable mechanisms are required to accurately predict this phenomenon. The available mechanistic models, like the de Waard–Milliams equation, though entrapping fundamental thermodynamics, do not withstand dynamic dosing and time-varying conditions. Although the conventional machine learning and deep learning models improve accuracy, though often lack physics consistency and interpretability. A Physics-Guided Temporal Transformer (PGTT), which integrates a Temporal Fusion Transformer backbone with a physics-informed loss (of de Waard–Milliams), and SHapley Additive exPlanations (SHAP) for feature attribution, is proposed here. By applying a comprehensive sequential dataset from 22 inhibitor dosing experiments (15,400 samples during 60+ hours), this PGTT achieves higher performance with an average , , and of over five independent runs, and outperforms Random Forest , , and MLP baselines. According to the SHAP, Temperature (26.5%) and CO₂ pressure (17.7%) are identified as the dominant stimulants, consistent with corrosion science. This case study reveals a reduction in prediction error of less than 5%, supporting proactive inhibitor dosing and pipeline integrity management.
Keywords
- Co2 corrosion,
- physics-informed learning,
- temporal transformer,
- SHAP,
- pipeline integrity
References
- C. d. W. D. E. Milliams, "Carbonic acid corrosion of steel," Corrosion, vol. 31, no. 5, May 1975 1975, DOI:https://doi.org/10.5006/0010-9312-31.5.177.
- M. M. H. J. Imran, S.; Mohamad Ayob, A. F, "A critical review of machine learning algorithms in maritime, offshore and oil & gas corrosion research: A comprehensive analysis of ANN and RF models," Ocean Engineering, vol. 295, March 2024 2024, DOI:https://doi.org/10.1016/j.oceaneng.2024.116796.
- J. C. Fang, X.; Gai, H.; Lin, S.; Lou, H. H, "Development of machine learning algorithms for predicting internal corrosion of crude oil and natural gas pipelines," Computers & Chemical Engineering, vol. 177, p. 108 358, July 2023 2023.DOI:https://doi.org/10.1016/j.compchemeng.2023.108358.
- L. B. Z. Coelho, Dawei; Van Ingelgem, Yves; Steckelmacher, Denis; Nowé, Ann; Terryn, Herman, "Reviewing machine learning of corrosion prediction in a data-oriented perspective," npj Materials Degradation, vol. 6, p. 8, 2022, DOI: https://doi.org/10.1038/s41529-022-00218-4.
- Z. Z. Dong, Min; Li, Weirong; Wen, Fenggang; Dong, Guoqing; Zou, Lu; Zhang, Yongqiang, "Development of a Predictive Model for Carbon Dioxide Corrosion Rate and Severity Based on Machine Learning Algorithms," Materials, vol. 17, no. 16, p. 4046, 14 August 2024 2024, DOI: https://doi.org/10.3390/ma17164046.
- A. S. Vaswani, N.; Parmar, N.; Uszkoreit, J.; Jones, Llion; Gomez, A. N.; Kaiser, Ł.; Polosukhin, I, "Attention Is All You Need," Advances in Neural Information Processing Systems (NeurIPS 2017), vol. 30, pp. 5998–6008, December 2017 2017, DOI:https://doi.org/10.48550/arXiv.1706.03762.
- J. W. Jiang, X.; Zhu, F.; Xiang, D.; Hu, Z.; Mu, S, "A deep learning framework integrating Transformer and LSTM architectures for pipeline corrosion rate forecasting," Computers & Chemical Engineering, vol. 190, p. Article No. 109365, 2025,DOI:https://doi.org/10.1016/j.compchemeng.2025.109365.
- M. P. Raissi, P.; Karniadakis, G. E, "Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations," Journal of Computational Physics, vol. 378, pp. 686–707, February 2019 2019, DOI: https://doi.org/10.1016/j.jcp.2018.10.045.
- A. V. Dourado, Felipe A. C, "Physics-Informed Neural Networks for Corrosion-Fatigue Prognosis," Proceedings of the Annual Conference of the PHM Society, vol. 11, 2019, DOI: https://doi.org/10.36001/phmconf.2019.v11i1.814.
- N. M. Chen, Rujin; Chen, Airong; Cui, Chuanjie, "PC-PINNs: Physics-informed neural networks for solving the phase-field model of pitting corrosion," Bridge Maintenance, Safety, Management, Digitalization and Innovation: CRC Press / Taylor & Francis, 2024, pp. 183–189. DOI:https://doi.org/10.1201/9781003483755-25
- X. L. Ma, Zhenzhi; Zhan, Jie; et al, "Prediction method of CO₂ plume distribution based on physics-informed neural networks," Petroleum Drilling & Production Technology, vol. 46, no. 5, pp. 90–98, 2024,DOI: https://doi.org/10.11911/syztjs.2024090.
- A. W. enkatraman, Mark A.; Montes de Oca Zapiain, David, "Accelerating charge estimation in molecular dynamics simulations using physics-informed neural networks: corrosion applications," npj Computational Materials, vol. 11, no. 1, 2025, DOI: https://doi.org/10.1038/s41524-024-01495-0.
- J. W. Jiang, X.; Zhu, F.; Xiang, D.; Hu, Z.; Mu, S, "A deep learning framework integrating Transformer and LSTM architectures for pipeline corrosion rate forecasting," Computers & Chemical Engineering, vol. 190, p. 109365, 2025, DOI:https://doi.org/10.1016/j.compchemeng.2025.109365.
- S. M. L. Lundberg, S.-I., "A unified approach to interpreting model predictions," presented at the Advances in Neural Information Processing Systems (NeurIPS 2017), 2017.DOI: https://doi.org/10.48550/arXiv.1705.07874
- Y. S. Q. W. X. Z. L. D. S. B. D. Z. Z. Z. H. Z. Y. Xi, "Interpretable machine learning for maximum corrosion depth and influence factor analysis," npj Materials Degradation, vol. 7, no. 1, 2023,DOI: https://doi.org/10.1038/s41529-023-00324-x.
- Q. H. Chen, W.; Wen, Y.; Wang, B.; Liu, G, "Degradation prediction and explainable analyses of the corroded subsea pipelines based on INSGAII-PGNN and SHAP algorithm," Ocean Engineering, vol. 334, p. Article no. 121495, 2025/08/01 (Aug 2025) 2025, DOI: https://doi.org/10.1016/j.oceaneng.2025.121495.
- B. A. Lim, S. Ö.; Loeff, N.; Pfister, T, "Temporal Fusion Transformers for interpretable multi-horizon time series forecasting," International Journal of Forecasting, vol. 37, no. 4, pp. 1748–1764, October 2021 2021,DOI: https://doi.org/10.1016/j.ijforecast.2021.03.012.
- L. Y. Tan, Y.; Zhang, K.; Liao, K.; He, G.; Tian, J.; Lu, X, "Prediction of internal corrosion rate for gas pipeline: A new method based on Transformer architecture," Computers & Chemical Engineering, vol. 198, p. Article No. 109084, 2025, DOI: https://doi.org/10.1016/j.compchemeng.2025.109084.
- I. M. S. Alqahtani, A.; Khan, M, "Experimental and theoretical aspects of crack assisted failures of metallic alloys in corrosive environments – A review," Materials Today: Proceedings, vol. 66, pp. 2530–2535, July 2022 2022, DOI: https://doi.org/10.1016/j.matpr.2022.07.075.
- M. M. Cid Montoya, A.; Verma, S.; Mures, O. A.; Rubio-Medrano, C. E, "Aeroelastic force prediction via temporal fusion transformers," Computer-Aided Civil and Infrastructure Engineering, vol. 39, pp. 319–344, January 2024 2024, DOI: https://doi.org/10.1111/mice.13381.
- R. W. U. Revie, H. H, Corrosion and Corrosion Control: An Introduction to Corrosion Science and Engineering (4th ed.). John Wiley & Sons, 2008.DOI: https://doi.org/10.1002/9780470277270
- G. T. He, J.; Sun, L.; Zhao, F.; Li, S.; Li, C.; Liao, K.; Chen, X.; Yang, W., "Research on natural gas pipeline corrosion prediction by integrating extreme gradient boosting and generative adversarial network," SSRN Electronic Journal, 2025,DOI: https://doi.org/10.2139/ssrn.5489826.
10.57647/spre.2026.1001.01