Calibration of Hydraulic Structure Discharge Coefficients by Integrating Firefly Optimizer and HEC-RAS Simulator in Python Environment

Document Type : Research Article

Authors

1 Water Sciences and Engineering Department, Faculty of Agriculture, Bu-Ali Sina University, Hamedan, Iran

2 Department of Water Sciences and Engineering, Faculty of Agriculture, Bu-Ali Sina University, Hamedan, Iran

3 Department of Water Engineering, Faculty of Agriculture, University of Zanjan, Zanjan, Iran

Abstract

Research Topic: Accurate hydraulic modeling is essential for the optimal management of irrigation networks.
 
Objective: This research aimed to develop an automated method for calibrating the discharge coefficients of structures in the HEC-RAS model. To this end, an innovative computational framework based on the Firefly Algorithm and using the Python programming language was created, which automatically controls the HEC-RAS software through its Application Programming Interface (API).
 
Method: In this study, 9 discharge coefficients related to three regulatory structures and six offtake structures in the E1R1 canal of the Dez irrigation network were optimized. The objective function was defined as minimizing the Mean Absolute Error between the simulated water depth in HEC-RAS and the target depth (design depth). The algorithm was executed with a population size of 10 over 35 iterations.
 
Results: Quantitative results demonstrated that the proposed method achieved high accuracy, with the final mean absolute error reaching 0.016 meters across 10 independent runs. Sensitivity analysis performed on the optimized discharge coefficients revealed that the downstream offtake structures had minimum discharge coefficient values of 0.32 and 0.31 respectively, while a key regulatory structure had a maximum discharge coefficient of 0.70. The discharge coefficients of the other structures converged within an intermediate range (0.47 to 0.63), indicating the existence of multiple optimal combinations to achieve the desired accuracy.
Conclusions: This research shows that the integration of HEC-RAS with metaheuristic algorithms can serve as an efficient and precise tool for the automated calibration of hydraulic models.

Keywords

Main Subjects


  • Alirezazadeh Sadaghiyani, A., Mohammadi, M., Galvani, M. and Vaheddoost, B. (2022). On the Prediction of Discharge Coefficient for Sluice Gates under Submerged Flow Conditions using Soft Computing Techniques. Journal of Modeling in Engineering20(71), 1-12. (In Persian).
  • Garbrecht, G. 1977. Discussion of “Discharge Computations at River Control Structures”. Journal of the Hydraulics Division, 103, 1481-1484.
  • Gharehbaghi, A. & Ghasemlounia, R. 2022. Application of AI approaches to estimate discharge coefficient of novel kind of sharp-crested V-notch weirs. Journal of Irrigation and Drainage Engineering, 148, 04022001.
  • Goodell, C. 2014. Breaking the HEC-RAS Code: A User's Guide to Automating HEC-RAS, h2ls.
  • Goodell, C. 2016. Advanced Gate Operation Strategies in HEC-RAS 5.0.
  • Leon, A. S. & Goodell, C. 2016. Controlling Hec-Ras using Matlab. Environmental modelling & software, 84, 339-348.
  • Rahmanshahi, M., Jafari-Asl, J., Fathi-Moghadam, M., Ohadi, S. & Mirjalili, S. 2024. Metaheuristic learning algorithms for accurate prediction of hydraulic performance of porous embankment weirs. Applied Soft Computing, 151, 111150.
  • Rajaratnam, N. 1977. Free flow immediately below sluice gates. Journal of the Hydraulics Division, 103, 345-351.
  • Shahverdi, K. & Yari, S. 2025. Investigating Effect of Flow Contraction on Discharge Coefficient of Lopac Gates Using Support Vector Machines. Water and Irrigation Management, 15(2), 497-508. (In Persian).
  • Sihag, P., Nouri, M., Ahmadpari, H., Seyedzadeh, A. & Kisi, O. 2022. Approximation of the discharge coefficient of radial gates using metaheuristic regression approaches. Sustainability, 14, 15145.
  • Spheerli, J. & Hager, W. 1999. Discussion of irrotationa flow and real fluid effects under planer gates, by JS montes. Journal of Hydraulic Engineering, 125, 208-210.
  • Swamee, P. K. 1992. Sluice-gate discharge equations. Journal of Irrigation and Drainage Engineering, 118, 56-60.
  • Yang, X.-S. Firefly algorithms for multimodal optimization. International symposium on stochastic algorithms, 2009. Springer, 169-178.
Volume 12, Issue 4
December 2026
Pages 1050-1067
  • Receive Date: 07 October 2025
  • Revise Date: 08 November 2025
  • Accept Date: 11 December 2025
  • First Publish Date: 22 December 2025
  • Publish Date: 22 December 2025