A Reproducible R–Fortran Toolkit for Groundwater Flow and Contaminant Transport Modeling in Watershed Applications

Hossein Ahmadi

J. Watershed Ecol. ›› 2026, Vol. 1 ›› Issue (1) : 10005

PDF (3331KB)
J. Watershed Ecol. ›› 2026, Vol. 1 ›› Issue (1) :10005 DOI: 10.70322/jwe.2026.10005
Article
research-article
A Reproducible R–Fortran Toolkit for Groundwater Flow and Contaminant Transport Modeling in Watershed Applications
Author information +
History +
PDF (3331KB)

Abstract

Uncertainty and calibration are major challenges in hydrologic and hydraulic analysis, especially in watershed applications involving groundwater flow and contaminant transport. This study presents an integrated modeling framework for comprehensive simulation of groundwater flow and contaminant transport, with automated calibration and sensitivity analysis capabilities. The framework extends traditional Fortran-based modeling by incorporating the statistical, numerical, and visualization strengths of the R environment. In the proposed approach, the Fortran code is executed within R, while the Fortran program employs a finite-volume time-splitting method to discretize the governing equations of groundwater flow and contaminant transport. Integration with R statistical packages improves model calibration, sensitivity evaluation, and visualization of groundwater contamination results. To illustrate the applicability of the framework, two test cases of groundwater flow and contaminant transport through porous media were conducted. Results demonstrate the accuracy, efficiency, and enhanced visualization capabilities of the integrated system. Ultimately, the framework is intended to support three-dimensional analysis of pollution plume evolution in heterogeneous media and to investigate interactions among multiple contaminant sources in watershed systems.

Keywords

Groundwater flow / Contaminant transport / Watershed modeling / R–Fortran integration

Cite this article

Download citation ▾
Hossein Ahmadi. A Reproducible R–Fortran Toolkit for Groundwater Flow and Contaminant Transport Modeling in Watershed Applications. J. Watershed Ecol., 2026, 1 (1) : 10005 DOI:10.70322/jwe.2026.10005

登录浏览全文

4963

注册一个新账户 忘记密码

Ethics Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

To support reproducibility and transparency, the Fortran and R source codes developed in this study are publicly available at the following GitHub repository: https://github.com/Ahmadi-Hosein, accessed on 25 April 2026.

Funding

This research received no external funding.

Declaration of Competing Interest

The author declares that he has no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

References

[1]

Hanoon MS, Ahmed AN, Fai CM, Birima AH, Razzaq A, Sherif M, et al. Application of artificial intelligence models for modeling water quality in groundwater: Comprehensive review, evaluation and future trends. Water Air Soil Pollut. 2021, 232, 411. DOI: 10.1007/s11270—021—05311—z

[2]

International Association of Hydrogeologists.Groundwater—More About the Hidden Resource; International Association of Hydrogeologists: Goring, UK, 2020.

[3]

Ramos—Ruiz A, Wilkening JV, Field JA, Sierra—Alvarez R. Leaching of cadmium and tellurium from cadmium telluride (CdTe) thin—film solar panels under simulated landfill conditions. J. Hazard. Mater. 2017, 336, 57-64. DOI: 10.1016/j.jhazmat.2017.04.052

[4]

Park S, Sung K. Leaching potential of multi—metal—contaminated soil in chelate—aided remediation. Water Air Soil Pollut. 2020, 231, 40. DOI: 10.1007/s11270—020—4412—6

[5]

Fairchild DM. A national assessment of ground water contamination from pesticides and fertilizers. In Ground Water Quality and Agricultural Practices ; CRC Press: Boca Raton, FL, USA, 2020; pp. 273-294.

[6]

Uliana MM. Identifying the source of saline groundwater contamination using geochemical data and modeling. Environ. Eng. Geosci. 2005, 11, 107-123. DOI: 10.2113/11.2.107

[7]

Shang F, Ren S, Yang P, Li C, Xue Y, Huang L. Modeling the risk of the salt for polluting groundwater irrigation with recycled water and ground water using HYDRUS—1 D. Water Air Soil Pollut. 2016, 227, 189. DOI: 10.1007/s11270—016—2875—2

[8]

Kuriqi A, Abd—Elaty I. Groundwater salinization risk in coastal regions triggered by earthquake—induced saltwater intrusion. Stoch. Environ. Res. Risk Assess. 2024, 38, 3093-3108. DOI: 10.1007/s00477—024—02734—y

[9]

Ite AE, Harry TA, Obadimu CO, Asuaiko ER, Inim IJ. Petroleum hydrocarbons contamination of surface water and groundwater in the Niger Delta region of Nigeria. J. Environ. Pollut. Hum. Health 2018, 6, 51-61. DOI: 10.12691/jephh—6—2—2

[10]

Yoon S, Yeom K, Kim Y, Park B, Park J, Kim H, et al. Management of naturally occurring asbestos area in Republic of Korea. Environ. Eng. Geosci. 2020, 26, 79-87. DOI: 10.2113/EEG—2287

[11]

Singh A. Decision support for on—farm water management and long—term agricultural sustainability in a semi—arid region of India. J. Hydrol. 2010, 391, 63-76. DOI: 10.1016/j.jhydrol.2010.07.006

[12]

Ahmadi H, Kilanehei F, Nazari—Sharabian M. Impact of Pumping Rate on Contaminant Transport in Groundwater—A Numerical Study. Hydrology 2021, 8, 103. DOI: 10.3390/hydrology8030103

[13]

Conant B, Jr., Robinson CE, Hinton MJ, Russell HA. A framework for conceptualizing groundwater—surface water interactions and identifying potential impacts on water quality, water quantity, and ecosystems. J. Hydrol. 2019, 574, 609-627. DOI: 10.1016/j.jhydrol.2019.04.050

[14]

Ahmadi H. Modeling of groundwater—surface water interactions: A review of integration strategies. ISH J. Hydraul. Eng. 2024, 30, 132-146. DOI: 10.1080/09715010.2023.2263434

[15]

El Himer H, Fakir Y, Stigter TY, Lepage M, El Mandour A, Ribeiro L. Assessment of groundwater vulnerability to pollution of a wetland watershed: The case study of the Oualidia—Sidi Moussa wetland, Morocco. Aquat. Ecosyst. Health Manag. 2013, 16, 205-215. DOI: 10.1080/14634988.2013.788427

[16]

Ahmadi H. An overview of non—point source pollution modeling: Current status and future prospect. J. Civ. Eng. Res. Technol. 2023, 5, 1-8. DOI: 10.47363/JCERT/2023(5)140

[17]

Du J, Jia C, Ding Y, Yang X, Feng K, Wei M. Advancing wetland groundwater pollution zoning: A novel integration of Monte Carlo health risk modeling and machine learning. J. Hazard. Mater. 2025, 494, 138412. DOI: 10.1016/j.jhazmat.2025.138412

[18]

Ahmadi H. An implicit numerical model for solving free—surface seepage problems. ISH J. Hydraul. Eng. 2022, 28, 391-399. DOI: 10.1080/09715010.2021.1925982

[19]

Ahmadi H. A numerical scheme for advection dominated problems based on a Lagrange interpolation. Groundw. Sustain. Dev. 2021, 13, 100542. DOI: 10.1016/j.gsd.2020.100542

[20]

Malaguerra F, Albrechtsen HJ, Binning PJ. Assessment of the contamination of drinking water supply wells by pesticides from surface water resources using a finite element reactive transport model and global sensitivity analysis techniques. J. Hydrol. 2013, 476, 321-331. DOI: 10.1016/j.jhydrol.2012.11.010

[21]

Zhou Z, Cui Z, Xu S. Impact of soil heterogeneity and NAPL presence on stable carbon isotope signature distribution during reactive transport. Water Air Soil Pollut. 2017, 228, 408. DOI: 10.1007/s11270—017—3528—9

[22]

Xie Y, Wu J, Nan T, Xue Y, Xie C, Ji H. Efficient triple—grid multiscale finite element method for 3D groundwater flow simulation in heterogeneous porous media. J. Hydrol. 2017, 546, 503-514. DOI: 10.1016/j.jhydrol.2017.01.027

[23]

Ramasomanana F, Fahs M, Baalousha HM, Barth N, Ahzi S. An efficient ellam implementation for modeling solute transport in fractured porous media. Water Air Soil Pollut. 2018, 229, 46. DOI: 10.1007/s11270—018—3690—8

[24]

Ahmadi H, Namin MM, Kilanehei F. Development a numerical model of flow and contaminant transport in layered soils. Adv. Environ. Res. 2016, 5, 263-282. DOI: 10.12989/aer.2016.5.4.263

[25]

Shokri N, Montazeri Namin M, Farhoudi J. An implicit 2D hydrodynamic numerical model for free surface—subsurface coupled flow problems. Int. J. Numer. Methods Fluids 2018, 87, 343-357. DOI: 10.1002/fld.4494

[26]

Guneshwor L, Eldho TI, Kumar AV. Identification of groundwater contamination sources using meshfree RPCM simulation and particle swarm optimization. Water Resour. Manag. 2018, 32, 1517-1538. DOI: 10.1007/s11269—017—1885—1

[27]

Rupali S, Sawant VA. 1 D contaminant transport through unsaturated stratified media using EFGM. Adv. Environ. Res. 2019, 8, 1-21. Available online: https://www.dbpia.co.kr/Journal/articleDetail?nodeId=NODE10234655 (accessed on 1 September 2019).

[28]

Basser H, Rudman M, Daly E. Smoothed Particle Hydrodynamics modelling of fresh and saltwater dynamics in porous media. J. Hydrol. 2019, 576, 370-380. DOI: 10.1016/j.jhydrol.2019.06.048

[29]

Diersch HJ, Kolditz O. Variable—density flow and transport in porous media: Approaches and challenges. Adv. Water Resour. 2002, 25, 899-944. DOI: 10.1016/S0309—1708(02)00063—5

[30]

Fakoor M, Zadeh PM, Eskandari HM. Developing an optimal layout design of a satellite system by considering natural frequency and attitude control constraints. Aerosp. Sci. Technol. 2017, 71, 172-188. DOI: 10.1016/j.ast.2017.09.012

[31]

Thyer M, Leonard M, Kavetski D, Need S, Renard B. The open source RFortran library for accessing R from Fortran, with applications in environmental modelling. Environ. Model. Softw. 2011, 26, 219-234. DOI: 10.1016/j.envsoft.2010.05.007

[32]

Schlather M, Huwe B. The use of the language interface of R: Two examples for modelling water flux and solute transport. Comput. Geosci. 2004, 30, 197-201. DOI: 10.1016/j.cageo.2003.08.007

[33]

Wu Y, Liu S. Automating calibration, sensitivity and uncertainty analysis of complex models using the R package Flexible Modeling Environment (FME): SWAT as an example. Environ. Model. Softw. 2012, 31, 99-109. DOI: 10.1016/j.envsoft.2011.11.013

[34]

Coron L, Thirel G, Delaigue O, Perrin C, Andréassian V. The suite of lumped GR hydrological models in an R package. Environ. Model. Softw. 2017, 94, 166-171. DOI: 10.1016/j.envsoft.2017.05.002

[35]

Eddelbuettel D, Balamuta JJ. Extending R with C++: A brief introduction to Rcpp. Am. Stat. 2018, 72, 28-36. DOI: 10.1080/00031305.2017.1375990

[36]

Bear J. Hydraulics of Groundwater ; McGraw—Hill: New York, NY, USA, 1979.

[37]

Ahmadi H, Kilanehei F, Mostafazadeh F, Hassanlourad M. Numerical and Experimental Simulation of Contaminant Transport Through Porous Media with a Sublayer. Int. J. Civ. Eng. 2025, 23, 1183-1202. DOI: 10.1007/s40999—025—01100—5

[38]

Xin Y, Zhou Z, Li M, Zhuang C. Analytical solutions for unsteady groundwater flow in an unconfined aquifer under complex boundary conditions. Water 2020, 12, 75. DOI: 10.3390/w12010075

[39]

Tindall JA, Kunkel JR, Anderson DE. Unsaturated Zone Hydrology for Scientists and Engineers ; Upper Rentice Hall: Saddle River, NJ, USA, 1999; Volume 4.

PDF (3331KB)

0

Accesses

0

Citation

Detail

Sections
Recommended

/